Version 5 of How do you unpost a menu

Updated 2004-01-07 14:31:31

PWQ 07 Jan 04 Again another Windows issue.

In an application A Mouse Click binding uses tk_popup to display a menu. Under Linux on ButtonRelease the menu is unposted.

On Windows, the menu stays visible until either a selection is made or a click is made outside the popup menu.

There is no 'unpost' command for a menu. Tried Using a binding to destroy the popup does not cause it to be removed.

'I have found there is an undocumented unpost command, but it fails to remove the menu'. I also tried invoking a dummy item but again there appears to be nothing other than a mouse click the will remove the menu.

Is there any way to get the Unix behaviour?


Bryan Oakley January 7 2004 I believe this is a bug in the windows implementation. Tk uses native menu which don't recognize tk's unpost command. I think the explanation is that when a menu is posted the code is running in a windows event loop rather than tk's so tk has no control over the window.

It's pretty annoying, and means you can't create menubars using menubuttons and expect to get the proper behavior WRT dragging the mouse over the menubar. It also explains the popup behavior that you see.

Peter Spjuth sent me a patch a while ago (way back in August 2003) that supposedly made the unpost command work but I haven't ever found the time to test it out (in spite of my assurances that I would -- sorry Peter!)