Is there any other way of getting the current row value of a listbox without deriving it from the cellclick event? Unless you load the row value into a variable during an appropriate event, there doesnt seem to be a property that constantly stores the Row value.
Have a look at http://documentation.xojo.com/index.php/ListBox.RowFromXY
[quote=102798:@Wayne Golding]Have a look at http://documentation.xojo.com/index.php/ListBox.RowFromXY
Thanks wayne.Call me lazy, but that seems like a very convoluted way to get the row value, especially when you consider the brevity of the Listbox.Column property.
Well if you’ve already clicked on the row then you can use listindex.
Listindex could be close as it keeps track of the currently selected row which can be changed by the arrow keys or by code, but it can be inaccurate, if you allow selection of multiple rows.
Thanks Wayne. List index works for me as I am using the listbox as a kind of menu.No multiple selections.
@Michel Bujardet I’m sort of stuck and in that situation. I need multiple selection and I was using cell click, but forgot about those arrow keys!
What’s the proper way to tackle it?
To tackle what ?
Moving the selection by arrow keys ?
Yes - the arrow keys will move the selection in the list box and I would like it to fire the same effect as if it were the cell that was clicked… I can’t use listbox.listindex as with multiple selection enabled… it will always reference the first listindex it comes to.
For example, if rows 1, 3, and 4 are selected, ListIndex returns 1. So I decided to go with CellClicked event but don’t know how to handle if the user selects using the arrows.
With multi select you can check each rows and see if it is selected
Thanks @Norman Palardy one more quick question… how do I check the order that it was selected using that method. I’m displaying an image each time the listbox item is selected and using that code it looks like no matter what order the selections were made if selecting 1, 4, 3 it would display 4. I do thank you for the time you are taking to help!
I’m assuming you mean which order the rows were selected via clicks ?
Selected has no notion of what order they are selected in
It simply says it is/is not selected currently
You’d have to do some tracking of mouse clicks etc and keep your own list in the order items were selected