Contextual Menu when mouse over ListBox row

I just can’t get this concept for some reason. I want to have a contextual menu appear when the mouse is over certain rows of a listbox.
I have defined a listbox class that has RowType Enumerations. For each row the RowType is stored in RowTag. When the mouse moves over a row with the RowType of “showContextualMenu” I want the contextual menu to appear. I defined an event “myContextualMenu” in the class. Then the class MouseMove event raises the “myContextualMenu” event if the RowTag is the desired one.
Then I put code in that event in the instance of the class to create a contextual menu. But I must still be missing something.

do you ever show the contextual menu (which I assume is actually just a popup menu created on the fly ?)

Yes it is supposed to be a popup menu created on the fly. Here is the code I have in the MyContextualMenu event. There is probably some code missing but I don’t see anything in the documentation.

dim base as new MenuItem

base.Append( New MenuItem("Test 1"))
base.Append( New MenuItem("Test 2"))
base.Append( New MenuItem("Test 3"))

return true

What event is this in ?

if its not in the create contextual menu event for the listbox then YOU have to popup the menu

see http://documentation.xojo.com/api/deprecated/menuitem.html#menuitem-popup

I use the ConstructContextualMenu event on the listbox to create my contextual menu. I suppose that relies on a right-mouse but I suppose nothing stops you raising that event on mouseover, if that’s what you want.

[quote=434221:@C T Baumgartner]dim base as new MenuItem

base.Append( New MenuItem(“Test 1”))
base.Append( New MenuItem(“Test 2”))
base.Append( New MenuItem(“Test 3”))

return true[/quote]

Unless this is in ConstructContextualMenu, you need to explicitly display the contextual menu. This can be done anywhere:

[code]Dim base as new menuitem

base.Append( New MenuItem(“Test 1”))
base.Append( New MenuItem(“Test 2”))
base.Append( New MenuItem(“Test 3”))

Dim m as menuitem = base.popup[/code]

Then you get the selected item in M.Text.