Close PopUpMenu Programmatically


Im building a http/SAOP request app and would love to have a menu pop up with the first five results that match the text input. I’m using the PopUpMenu to show the results as the user types, but the pop-up menu is modal so the user would have to click somewhere else to dismiss it.

Is there a hack for this or is my best bet building a custom component.


PopupMenu::dismissAllActiveMenus() ??



The ever present miraculously appearing function!


This was actually the first thing I tried.

I want to close the menu if the user keeps on typing in the search field. So every keystroke brings up possible results in a new PopUp. I have a TextEditorListener that pops up the menu, but the menu is modal so nothing gets registered with the ParentWindow and/or its shild components until this child PopUpWindow returns.



oh, that’s quite tricky, isn’t it… I guess what you could do is to find the menu window with Component::getCurrentlyModalComponent, and attach a key listener to it to send the events to the texteditor.


ah. Thats interesting, Ill give it a shot.