Tech Tip: The List Box Selection, The List Box variable, and Multiple selection
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: June 11, 2009
A List Box can have its selection mode set to one of the three following modes:
- None means that you cannot select any rows at all.
- Single means that only a single row can be selected at any given time.
- Multiple means that you can have multiple rows selected at the same time.
In order to check whether or not a row is selected in a List Box that has its selection mode set to Multiple you must check the variable of the List Box itself. Here is the Property List for the List Box we will be using in this example:
The List Box variable is a Boolean array with an element for each item in the List Box. Selected items will show as True, while in contrast unselected items will show as False.
Let's say you have a List Box with a variable named LBox1. In this List Box let's say you have six rows, of those six rows the first and last are unselected while the inner four are selected, as shown here:
Checking the values of the LBox1 array would show the following:
LBox1{1}=False ` first row LBox1{2}=True ` 2nd row LBox1{3}=True ` 3rd row LBox1{4}=True ` 4th row LBox1{5}=True ` 5th row LBox1{6}=False ` 6th row |
Selected rows are True and unselected rows are False.
If the "Data Source" to the list box is set to "Current Selection", the method to highlight a selection is with the Named Selection as entered in the "Highlight Set" property in the List Box Property List.