How do I get the main window? I have been trawling the docs for that.
I understand what's going on then. The ActiveGadget is never actually set to the menu - therefore the next message (a mousedown event) is causing the loop to terminate.
Here is the original problem with a test graphics window
I understand what's going on then. The ActiveGadget is never actually set to the menu - therefore the next message (a mousedown event) is causing the loop to terminate.
Here is the original problem with a test graphics window
Strict Graphics 640,480 While Not KeyDown(KEY_ESCAPE) Cls DrawText "Right mouse to invoke popup menu", 10,10 Flip If( MouseHit( 2 )) Local window:TGadget = CreateWindow("win", 0,0,10,10, Null, WINDOW_HIDDEN | WINDOW_MENU ) Local menu:TGadget = CreateMenu( "Menu", 0, WindowMenu( window )) CreateMenu( "Item 1", 1, menu ) Local done = False PopupWindowMenu( window, menu ) While Not done WaitEvent Local id = EventID() Local dat = EventData() Select id Case EVENT_MENUACTION Select dat Case 1 Notify("Item 1 clicked") done = True EndSelect EndSelect Wend FreeGadget( window ) FlushMouse() EndIf Wend