Context menu in listbox cell

I’m hoping that someone can point me to examples on how to make use of ActiveCell and TextEdit as it applies to editing a listbox cell.
What I want is for a listbox cell to allow a user to enter text after a left click, or choose from a context menu after a right click, consistently.

What I end up with is that the context menu is not available if the cell is already active due to being left clicked. The user would then have to click a different cell, then come back to the desired cell, being careful to right click it this time, to get the context menu.

Any have any good deep dive / discussion in to this?

I’ve searched and think that the answer likely lies in how the active cell is treated as a textfield or textarea, I just don’t get how to harness that to get greater control I guess.

From the LR:

When a cell is editable, the ActiveCell property is the TextEdit that contains the contents of that cell. This may be a TextField or a TextArea depending on the specified column type. You can use this property to set or get the text of the Listbox cell, set the selection, or change other properties of the ListBox’s TextField or TextArea.

2018 r4, so api 1

Thanks!

On OSX, the default ContextualMenu is available when I right click in an active Cell.

I feel there is something I do not understand in your explanation.

BTW: the first Right Click act as if it was a left click (select the clicked Cell); you have to issue a second right click to display the ContextualMenu…

ActiveCell does not have mouse events. So you cannot do what you would do with another control.

Your best course of action would be to use the Listbox MouseDown event, with something like this:

[code]Function MouseDown(x As Integer, y As Integer) Handles MouseDown as Boolean
If me.rowfromXY(x,y) = 0 and me.columnfromxy(x,y) = 0 and IsContextualClick then
dim base as new menuItem
base.append(New MenuItem(“One”))
base.append(New MenuItem(“Two”))
base.append(New MenuItem(“Three”))

Dim selectedMenu As new MenuItem
selectedMenu = base.Popup

Select case selectedMenu.text
case "One"
  Msgbox "One"
case "Two"
  Msgbox "Two"
case "Three"
  Msgbox "Tree"
end select

end if
End Function
[/code]

Looks like I was handling things in the wrong order, then getting in my own way. Thanks for the help!