tk_popup behaves differently on unix and on windows.
windows:
* The <Unmap> binding isn't fired when the popup
dissapears, which includes when the user doesn't select
one of the menu items.
* All processing of the script stops as soon as the
popup is displayed. The script continues where it left
off after the popup dissapears.
unix:
* Here the <Unmap> binding actually gets fired when
the popup dissapears.
* Processing of the script continues after the popup
is shown. The rest of the script doesn't wait for the
popup to dissapear.
For more information see
http://mini.net/tcl/3713
Rohan Pall
http://www.RohanPall.com
Logged In: YES
user_id=72656
do you have a simple script that can display these behaviors
for testing?
Probably beating a dead horse here, but I just stumbled on this problem today. Here is a script reproducing it:
------------
menu .m
.m add command -label Test -command { puts "Item selected" }
bind .m <Unmap> { puts "Menu unmapped" }
proc post_menu {x y} {
puts "tk_popup called"
tk_popup .m $x $y
puts "tk_popup returned"
}
bind . <1> { post_menu %X %Y }
------------
Just run the script and click on the window, then select the menu item. Here is what is printed on Linux:
tk_popup called
tk_popup returned
(Actual menu item selection occurs here)
Menu unmapped
Item selected
And here is what is printed on Windows (and on the Mac by the way):
tk_popup called
(Actual menu item selection occurs here)
tk_popup returned
Item selected
So tk_popup only returns when the menu item has actually been selected here, while it returns immediatly on Linux. And the <Unmap> binding is never called on Windows or on the Mac.
Not really a big problem since there is a way to know when the menu has disappeared on all platforms, so it's easy to get the same behaviour everywhere. But the platform type has to be tested anyway to know how things should be handled.