[PD] openpanel window popup behaviour

CICCOLIX ciccolix at tiscalinet.it
Wed Aug 26 09:01:41 CEST 2009

glerm soares ha scritto:
> Hiya,
> Is the openpanel popup window for choosing files default behaviour to 
> appear back from the window you are running your patch? Seems tha this 
> don't make too much sense and the worse is that some people get stuck 
> when the window is invisible if the patch is with window maximized. I 
> have seem this several times...
> Strange that in ubuntu-gnome with compiz working the default behaviour 
> is not that because the window is poping up in front of all patches. 
> That's the more desirable, but seems that's it is dependent of desktop 
> configs?
> Is there anyway to assure the openpanel window will popup in front of 
> the running patch window?
yes, I did this by modifying the source code of pd.tk, just adding the 
-parent option to the tk_getOpenFile command.
The proc "pdtk_openpanel" modified look like this:

proc pdtk_openpanel {target localdir} {
    global pd_opendir
    if {$localdir == ""} {
      set localdir $pd_opendir
##discover the patch window in front of you
    set last_patch_window [lindex [split [wm stackorder .] " "] end]
##tell tcl to make the opened panel to be cild of the patch in front of you
    set filename [tk_getOpenFile -parent $last_patch_window -initialdir 
    if {$filename != ""} {
        set directory [string range $filename 0 \
            [expr [string last / $filename ] - 1]]
        set pd_opendir $directory

        pd [concat $target callback [pdtk_enquote $filename] \;]

tested only on linux

More information about the Pd-list mailing list