V4 released!

 From:  Michael Gibson
10083.129 In reply to 10083.128 
HI Marco, if you show it as a dialog it's possible for a dialog to implement a function OnKeyDownEvent( event ) in it which will give it a chance to process keyboard events if it is the current focus window. There's an example of that in ShortcutKeyDialog.htm .

So for your case where you want it to hide on any keystroke, you could implement this script function inside the page:

code:
			function OnKeyDownEvent( e )
			{
				moiWindow.close();
			}


Then for showing your UI use moi.ui.createDialog( 'DialogUrl.htm' ); instead of showMenu().

Does that work?

I'll see about making the keyboard event processing work for flyout menus as well as dialogs for v5.

- Michael