MaxGUI - pop up menu events

BlitzMax Forums/BlitzMax Beginners Area/MaxGUI - pop up menu events

Hi Chris,

Great idea, thanks. And........ it works!

But, there's a problem. Check out the following code :-

			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
				
				ShowMouse()
				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
							
					If( ActiveGadget() <> menu )
						Notify( "Menu closed")
						done = True
					EndIf
				Wend
				
				FreeGadget( window )
				HideMouse()
				FlushMouse()
				
			EndIf



IF the activegadget is not the menu for any reason - the code which selects the eventID does not appear to be executed. What's going on here? Am I going mad, is there some kind of early-out compiler optimisation getting in the way?