Desktop.listbox

I am trying to use RowSelectionType. But i dont really get what is the exum meaning.Can you help me with that? How to declare the RowSelectionType value

The documentation is your best friend; read it in this order:

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

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

…and if this is unclear, write an issue against the documentation.

Unfortunately i am new to xojo and i already read the documentation but i couldnt make it right.Can you write me a code?

Assuming that your DesktopListBox is called MyList then the code would be as follows:

MyList.RowSelectionType = DesktopListBox.SelectionTypes.Single
// or
MyList.RowSelectionType = DesktopListBox.SelectionTypes.Multiple
// This will not work, it is a Class enumeration not a property of the individual control.
MyList.RowSelectionType = MyList.SelectionTypes.Single

Unfortunately the documentation is wrong as the properties section of DesktopListBox is showing RowSelctionType as an Integer and not the enumeration which would be RowSelectionTypes, this is however correct in the IDE when you view the bottom window as you type. It is then also badly written for DesktopListBox — Xojo documentation which doesn’t really help you, an example should be shown there.

See DesktopListBox — Xojo documentation for the enumerations used in DesktopListBox.

In this case it would be

Listbox1.RowSelectionType = DesktopListBox.RowSelectionTypes.Single
or
ListBox1.RowSelectionType = DesktopListBox.RowSelectionTypes.Multiple

See this for further reading on what enumerations are, they can be used where Integers are expected as they are essentially readable names for integer values, so Single would be 0 and Multiple would be 1 or the next number in the “list”:

https://documentation.xojo.com/api/data_types/enumeration.html#enumeration

I’ve asked for autocompletion on enumerations to aid coders new and old, but it hasn’t been forthcoming:

#63873 - Autocomplete enumeration assignment

This has just been fixed in the documentation. Thanks for pointing it out.

1 Like

On the link at the end of RowSelectionType As RowSelectionTypes here, you’ve pointed the anchor to GridLineStyles and not RowSelectionTypes so it takes you to the wrong section.

So, the link that is currently:

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

where Julian has pointed out, should be:

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

The link is still wrong @Geoff_Perlman, see my post above.

OK, I have just fixed that in the docs for r2.

1 Like