Popup Menus

BlitzMax Modules Forums/Brucey's Modules/Popup Menus

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

got it.
' intercept all menu events And Log them in this custom event handler
PushEventHandler(New MyEvtHandler.Create(Self))


is needed in the Frame OnInit method and
' A small helper type which intercepts all menu events And logs them
Type MyEvtHandler Extends wxEvtHandler

	Field frame:MyFrame
	
	Method Create:MyEvtHandler(_frame:MyFrame)
		frame = _frame
		Return MyEvtHandler(CreateHandler())
	End Method
	
	Method OnInit()
	    Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, OnMenuEvent)
	End Method
		
	Function OnMenuEvent(event:wxEvent)
		DebugLog "Popup Menu item Chosen"
		Select event.GetId()

		    Case Menu_Add_SelectorType
        	DebugLog "You clicked on ADD"

'    		Case ID_lb2
 '       	DebugLog "You clicked on Fred!"

		End Select	
'		MyEvtHandler(event.parent).frame.LogMenuEvent(event)
	
		event.Skip()
	End Function

End Type

is needed to do the actual work.