Right Click on a control

BlitzMax Modules Forums/Brucey's Modules/Right Click on a control

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.

You have two sets of Connect/Any() plugged into a right-down/context menu event.
Is that what you want?

The first thing to happen will be the Right-down, which, if you want it to get to the context menu event, you will have to Skip() - otherwise it is consumed and will not advance to be further processed.


If you remove the Connects() for Right-Down, and change your context menu connect to :
Connect(ID_lb1, wxEVT_CONTEXT_MENU, OnContextMenu)

The menu opens as expected on the first list box.

Or, you might use this instead :
m_listBoxPopup2.ConnectAny(wxEVT_CONTEXT_MENU, OnContextMenu, Null, Self)

which connects listbox2 to a context menu event. Notice here though, that you require to pass the Frame as the "sink" parameter, since you want that reference back during the callback (which you access via event.sink).
In this case, you will need to change your callback function to use the sink instead :
	Function OnContextMenu(event:wxEvent)
		Local frame:MyFrame2 = MyFrame2(event.sink)

since "parent" will be the listbox.

In normal use, sink and parent are the same object.
Parent tends to be the object that the connect belongs to. However, the sink param of Connect enables you to add another object reference to the event, which can be very useful, as is the case in the above example.