Listbox, CellClick and highlighted selections

Hi everybody,
in a project of mine I’ve edited the Event Handler “CellClick” of a listbox in order to make it fire a SQL query which I need; the only problem is that, doing so, I lose the fact that the selected rows become highlighted during selection.
How can I make them return to the previous standard behaviour whilst mantaining all the source code I need?

Many thanks to everybody for the kind replies.

When you select a Cell, in fact, you are using a TextField (Check the doc). You only have to get the reference to this field and select its whole contents.

In the Listbox entry of the LR:

When a cell is editable, the ActiveCell property is the TextField that contains the contents of that cell. 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.

Ask if this is unclear.

Not so clear, even because all the cells are un-editable…

If the Cell (one) is not editable, how would you highlight it ?

In other words: if the Cell is editable, you can (after the Mouse CLick) in the MouseClick Event select all the characters (or less) etc. using the ActiveCell as written above.

If the Cell is not selected, you cannot select its contents (or only select the whole Row).

How do I set a Cell editable ? Read the example just above the quoted text (above).

In fact, you do not set any Cell as Editable… AFAICS.

Edit: Example of use

Me.ActiveCell.Mask = "9999-99-99"

I Put that code in CellGotFocus, and this set a Mask for a SQLDate entry field.
(I checked the Listbox heading for that column against the Date word, if present, I set the edit mask).

Return False in your CellClick and you should get the row highlights.

Great, GREAT solution Julian
If only I could understand why it works like so…
Nevertheless, thank you!

If you return False you’re essentially telling the framework to handle all the default operations of the click such as moving the selection. If you return True you’re telling the framework that you’ve handled things like that and it doesn’t need to.

See Notes under https://documentation.xojo.com/index.php/ListBox.CellClick