ListBox item selection

Greetings -

Trying to work with ListBox (XOJO 19R3.1 testing on Mojave).

I would like to allow only contextual clicks. But, ordinary clicks select the entire row and the selection persists after the mouse button is released. I have no MouseDown or MouseUp handlers but do have a ConstructContextualMenu handler. I’d prefer no select-click action at all but would accept a row that is selected while the mouse is down and deselected when the mouse goes up. All attempts to work with the MouseDown and MouseUp handlers result in either no change from the default, or ignoring contextual clicks.

Can someone help me with the magic sauce to get this to work?

Many thanks
Jim Wagner
Oregon Research Electronics

you can check that right mouse button via
https://documentation.xojo.com/api/language/is.htmlContextualClick
and be sure you return true or false at the mouse events which have a return value.

Will work with that!

Well, close but ,

If I put an IsContextual test in the MouseDown event (and return false if it is, otherwise true), it suppresses the select action. That is GOOD! The “but-side” is that cells in which contextual click IS allowed, the row is left selected even though the ContextualMenuAction event ends by deselecting with MyListBox.SelectedRowIndex = ListBox.NoSelection. Ooops, I mis-wrote! As just quoted, it does work. When I set SelectedRowIndex to -1 (no header row is used), THAT failed. So, it looks OK.

Thanks
Jim