Re: Sticky popup menus



Donald Arseneau wrote:
Brian Griffin <briang42@xxxxxxxxxxxxxx> writes:


I've had complaints that the popup menus in our application are not sticky on
*nix like they are on Windows. This is where the popup menu would stay when
you do a button down, button up sequence. Instead you have to hold the mouse
button down to scan the menu.  I have modified menu.tcl to make popups (via
tk_popup) sticky, but I don't know if others perceive this as a problem that
should be fixed.


Tk popup menus *are* sticky on *nix!

You are probably hitting the misfeature/bug:

http://groups-beta.google.com/group/comp.lang.tcl/browse_thread/thread/d33f85bd762da1c

and

http://sourceforge.net/tracker?func=detail&aid=680660&group_id=12997&atid=112997

The fix is simple (see the web postings) for menuuttons...

bind Menubutton <Button-1> {+
   bind [winfo children %W] <ButtonRelease-1> {break}
   after 300 { bind [winfo children %W] <ButtonRelease-1> {}}
}

(I use 300 ms delay instead of 150 nowadays.)

If you are popping up the menu by some other method, you must find your own
way of initially binding <ButtonRelease-1> {break}, but after a delay, bind
<ButtonRelease-1> {}.

Jeff, that Sourceforge tracker item is still open.  Is there any hope of
getting the built-in bindings changed?  Perhaps performed by the post
operation rather than another button binding?


Yes, there is a problem with menubuttons, but that problem is really in the location of the posted menu, not a timing problem. That's a problem with the menubutton widget only.


The issue I'm talking about is with the use of tk_popup. When tk_popup is called, the ButtonRelease event unposts the menu, regardless of when or where the mouse is located. It shouldn't require complicated mouse bindings to fix this, and it doesn't. The change I have is just 3 lines in menu.tcl. The real question is: should this default behavior be changed in Tcl?

-Brian
.