Tech Tip: Selected Listbox Rows in Listbox array
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: November 20, 2013
When a listbox is populated, the rows can be selected. Selecting a row will highlight it on the listbox.
A listbox can be thought of as an array of boolean values. All rows that are selected have the value of true. All rows that are not selected are false.
For example, if there is a listbox with 7 values with rows 2 and 3 selected, the listbox array will look like this:
Listbox{0}=False Listbox{1}=False Listbox{2}=True Listbox{3}=True Listbox{4}=False Listbox{5}=False Listbox{6}=False Listbox{7}=False |
*Listbox is the name of the List Box object
To find all the true values, use Find In Array(Listbox;True;$start) in a loop. This will allow user to retrieve all the selected rows, and perform actions on it, like deleting all selected row. An example for deleting all selected listbox rows can be found in the tech tip below.
See Also: