Shouldn't the first listbox dehighlight?

I have some multi-column editable listboxes and when I select the second one after selecting the first, the first doesn’t de-highlight. Is this a bug?

Here’s a video depicting this behavior:
https://vimeo.com/manage/videos/647175715

This is on Mojave with 2021r2.1.

Can’t watch the video:

have you tried calling refresh on the listbox (only a guess)

I had to connect with gmail account to watch the video. I hope they won’t spam me :confused: .
The cell is not selected it is in grey. When I select a cell in a listbox, the line is in blue. And then another cell in another listbox the line in the previous listbox become grey.
I suppose it’s because you personalised the colors.

To answer your topic question: No.
The first listbox loses its focus when the second is selected. That’s the blue border and works as expected.

It does not lose its selection automatically. If you want to attain this, you should use the LostFocus (or whatever the current event name might be) event to also deselect the selected row(s).

Sometimes such irregular behaviour can also be triggered when a ListBox selection/focus event is overridden but returns the wrong Boolean, so you find yourself working against the OS.
BTW, you find the exact same behaviour in the Navigator where an object can be selected but not have the focus so you have to click the row again to make keyboard commands work.

But if you want this feature, Add the LostFocus Event to this ListBox and clears the Highlight in code.


ListBox1.ListIndex = -1 // Deselect all rows

More in the docs under ListBox.

Thanks for the info. It works.

By the way, I see that in release 3, ListBox is being replaced by DesktopListBox. The LostFocus event becomes FocusLost for example. ListIndex becomes SelectedRowIndex.