View Full Version : MessageBox close action causing visible Menu to hide

2 Jul 2013, 3:51 AM
I have a split button on a toolbar with a Menu, and one of the menu items causes a MessageBox to appear. When it appears, the menu remains visible below the mask of the MessageBox, so far so good. On closing the MessageBox, when an OK button is clicked, the visible menu is then hidden.

I guess this is default behaviour in the framework, but I wondered if there was an easy way I could prevent the hide action happening on the Menu component?

I started hooking into the beforehide handler on the Menu and looking at the event object to determine if the target was from the Ok button of the MessageBox and return false in the handler to stop it from hiding. But I just thought I'd share in case anyone else can advise a better way!


4 Jul 2013, 5:52 AM
I believe the reason this is happening is because the menu manager will listen for mousedown events on the document and if it's not within the menu then it will close the menu.

You could also set a flag if the menu should hide and return it in the beforehide of the menu (returning false will stop it)