How do you unpost a menu

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!)

PWQ I would be one of many people that would appreciate your effort in getting this to work.

In hindsight, it would appear that going for native look and feel has been determental to cross platform consistency.

Peter Spjuth 2004-01-19: I do have a half-finished patch for among other things the unpost command on Windows. The goal of the patch is to make it possible to get a group of menubuttons to behave like a menubar. That unpost command does not work like on Unix but at least it make it possible to unpost. I hope to finish the patch before 8.5.