Hey all,
Upon extending popup to include an argument to specify the vertical size I realized an anoying bug requiring advice.
The bug is that when the patch window is minimized the popup (and entry) objects all disapear! Then can still be selected when the window is un-minimized but the widgets themselves are gone. PD returns a string like:
windowname already exists in parent.
I've put debug messages in all my PD functions and I can't find what function is trying to do the improper thing. The message just seems to come up after the getrectfn completes.
I'm looking to gcanvas for inspiration but I can't quite figure out what function gets called when a window is unminimized.
Any suggestions of where to look? I used Guenter's "button" as an example and built from there. Looking back it would be really nice to have a standard example of a gui external. Of course this does bring up issues when/if the g_canvas interface changes, but I also think it would be valuable to encourage the development of GUI externals. Of course I'd rather use toxy to make gui externals but have had issues that keep toxy from being able to do what I need (specifically GOP support and the ability to specify the exact pixel size of the widget container in the patch.)
It also occured to me looking at the code again that I should change the displace function so that rather than re-creating the widget it simply moves the widget in the canvas via canvas coords. Anyone see any issues caused by this? It may also help with the movement of other gui externals if they are not already using this function.
Thanks all for help.
PS: I'm now again in a situation where I'll be able to play with toxy more, and I would really love to be able to recreate "popup" and "entry" as a patch & widget file if I was able to use it in the same way I currently am (sized precisely and used in a GOP abstraction)
Not to put any cogs in the gears but I think I would be most happy if I could put something like the following into a .wid file and use the widget in toxy:
# Define widget variables:
set wid #provided by toxy set wid_struc($wid.container) # provided by toxy set wid_struc($wid.alias) popup # name of object to call set wid_struc($wid.tag) "popup1" set wid_struc($wid.width) 100 set wid_struc($wid.height) 25 set wid_struc($wid.relief) raised set wid_struc($wid.bgcolour) black set wid_struc($wid.name) "my popup" set wid_struc($wid.num_options) 5
# Create the Widget
menubutton $wid_struc($wid.container).w -relief $wid_struc($wid.relief) -background $wid_struc($wid.bgcolour) -text $wid_struc($wid.name) -direction flush -menu $wid_struc($wid.container).w.menu
menu $wid_struc($wid.container).w.menu -tearoff 0
for {set i 0} {$i < $wid_struc($wid.num_options)} {incr i} { $wid_struc($wid.container).w.menu add command -label "test" -command {outlet_symbol(test)} }
Where toxy provides:
The uniqe $wid value A parent to bind the widget to with: .c create window x_pos y_pos -width $wid_struc(width) -height $wid_struc(height) -anchor $wid_struc(anchor) -window $wid_struc(container) -tags {something-from-toxy $wid_struc(alias)}
Perhaps some of the wid_struc variables could be accessible with via properties dialog.
Anyhow I'm a very familar tcl/tk programmer and found toxy a little difficult to get my head around. I think it could be a lot easier to use it to build widgets. I do think toxy is the future of GUI design for PD!
Enough of me.
Ben