I’m guessing that when a cell is clicked, that row is not marked as selected until after the cellclick event handler has completed. That’s a nuisance for a number of reasons. The user may have held down shift when clicking - so instead of one row being selected there are now, say, 10. But only one event occurs, and if I look at selected rows inside the event handler, I’ll only see the already-selected one.
How can I see whether the shift key was held down when the user clicked? And, since DragReorderEnabled is false, whether the user drag-selected a number of rows?
Remember that there are multiple ways to select more than one row.
Works fine here (Listbox Change event):
[code]Sub Change()
DIM selectedRows() AS String
FOR i AS Integer = 0 TO ME.LastIndex
IF ME.Selected(i) THEN
selectedRows.Append str(i)
END IF
NEXT
Label1.Text = Join(selectedRows, EndOfLine)
End Sub
[/code]
Yes. And this made me realise that I can’t do it all from the cellclick handler. The best time to collect which rows are selected is when that information is about to disappear - the listbox is going away - or when I need it in order to use it. Then it won’t actually matter how the rows were selected.
[quote=245916:@Michel Bujardet]Look at Keyboard.AsyncShiftKey
http://documentation.xojo.com/index.php/keyboard[/quote]
Thanks - this will prove to be very useful later in the process of porting my app to Xojo.