[listbox] Check order items were selected?

Hello,

I need to let the user select a From and To items from a list.

To avoid creating two listboxes, can the listbox widget return the order in which items were selected, so that the user simply needs to make sure the first item selected is the From and the next one is the To?

To start again from a clean plate, I’ll also need to add a Clear button.

Thank you.


Edit: I guess I could use an array and fill it with id’s every time the user clicks on an item in the listbox

A ListBox does not keep track of the order the items is selected. But as you suggest in your Edit, you can Bind the EVT_LISTBOX event and then keep track of the order that way. You may have to consider the user “changing their mind” and unselecting items before selecting other items, before they are “done”.

1 Like

Yup. I could disable the listbox once the user has selected two items to force them to hit the Clear button and start again in case they change their mind for the From/To items.