Listbox set multiple rows as selected

I have a multiple select desktop listbox. I can enumerate the selected rows and see if a row has the .Selected property.

However when I was to reload this listbox and show the user the listbox with multiple selected rows, I cannot because the the .Selected property is read-only.

How can I SET multiple rows of a listbox as selected? Example image attached.

Thank you!

Listbox.Selected and DesktopListbox.RowSelectedAt are not supposed to be read-only. Have you done any subclassing?

https://documentation.xojo.com/api/deprecated/listbox.html#listbox-selected

https://documentation.xojo.com/api/user_interface/desktop/desktoplistbox.html#desktoplistbox-rowselectedat

The method that you’re looking for is on the DesktopListbox itself, not the DesktopListBoxRow.

You are correct that the DesktopListBoxRow.Selected property is read only, but DesktopListbox.RowSelectedAt is read/write.

Ah, TIL DesktopListbox has an iterable.

Thanks, that did it!

Setting RowSelectedAt is the right property to do this. Cheers!