Turn off Selection highlight in Listbox

I am using a listbox cosmetically as a convenient way to display a legend. However I can’t find a way to make the listbox “non selectable” i.e. to disable the highlights of darkish blue and grey. I have tried most things to “hide” the selection highlight - resetting focus, me.listindex=-1, even me. selectiontype=-1 (which bizarrely switches off some rows but not all of them!)

WHat I want to do is to be able to click on column 1 (which is painted as a colour) invoke the colour picker - change colour to selected. Everything work except for the selection highlight is invoked after the click rather messing up the legend purpose of the listbox.

Also my listbox seem to be grouped with a canvas and I can’t “decouple” or ungroup it. How is this done (thought I knew, but I don’t as nothing seems to decouple it)

Thanks

try:

Function CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
Return true
End Function

THanks Joachim, I’ll try that but since the listbox is grouped with a canvas I cannot even see the listbox. It has just disappeared. No idea what’s going on. But thanks for the suggestion.

Hi Joachim, had to rewrite canvas and listbox as I could not uncouple them from being grouped. Big problem in xojo. But your insight worked so thank you

[quote=22764:@Joachim Kuno]try:

Function CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
Return true
End Function[/quote]

The problem with that is people can still tab into it on Windows and on OSX if they have Fullkeyboard access turned on. If you take it out of the tab order too that might work

Another option would be to Disable listbox and in CelltextPaint do:
g.forecolor = Textcolor so the text does not look disabled

  • karen

Thanks for the suggestion Karen. I set the tab stop to off and that work even better as it appears tabbing misses out the selection of the listbox altogether (when tabbing). Still do not get the grouping issue though