How do I ClearFocus a DesktopListBox?

The subject line says all:

How do I ClearFocus a DesktopListBox ?

Xojo 2025r2.1

Maybe:
listbox1.AllowFocusRing = False

Works fine, thank you.

1 Like

Listbox1.SelectedRowIndex = DesktopListBox.NoSelection

AllowFocusRing = False means you probably can’t see when a row IS selected.
Havent tested…

Thank you for your advice, but I do not care about a selected row there. The ListBox (in this case) is just an information displayer.

But it have the Focus by default (vs one of the Canvas).

All I wanted to achieve is to give the Focus to a Canvas, so the user can press the Delete Key and Clear the Canvas Contents (in case of an error)…

In the window’s Opening event: theCanvas.SetFocus.

And Check the ¨Pro^perties in the IDE:

Allow Focus Ring = True
Allow Focus = True

and for good measures:
Allow TRabs = True

PS: I use Xojo since REALbasic, in May 1998 (27 years…)