Guest_imported
New member
- Jan 1, 1970
- 0
In my application I would like to be able to destroy (and recreate) a menubutton. The problem occurs if the menu is still posted when the menubutton is destroyed (i.e. no selection was made, or the user did not click outside the window). Under these circumstance, if the menubutton is then recreated, the menu is no longer dislayed properly (sometimes it won't display at all). I have tried "unpost"ing the menu before destroying the menubutton but this doesn't seem to have any effect.
The version of tcl/tk I'm using is 8.4 and the platform is Solaris. Below is the test code to reproduce the problem. Try clicking on the menu button when it comes up and waiting until the program destroys it -- then try to open the menu again. After some time and multiple clicks the menu usually reappears -- but this behavior is inconsistant and I would like it to be dismissed properly.
proc create {} {
menubutton .mb -text Sample -relief raised -menu .mb.menu
pack .mb
set m [menu .mb.menu -tearoff 0]
$m add radio -label One -command {}
$m add radio -label Two -command {}
}
create
after 10000 {destroy .mb; create}
Your help would be greatly appreciated!
The version of tcl/tk I'm using is 8.4 and the platform is Solaris. Below is the test code to reproduce the problem. Try clicking on the menu button when it comes up and waiting until the program destroys it -- then try to open the menu again. After some time and multiple clicks the menu usually reappears -- but this behavior is inconsistant and I would like it to be dismissed properly.
proc create {} {
menubutton .mb -text Sample -relief raised -menu .mb.menu
pack .mb
set m [menu .mb.menu -tearoff 0]
$m add radio -label One -command {}
$m add radio -label Two -command {}
}
create
after 10000 {destroy .mb; create}
Your help would be greatly appreciated!