Workbench User Guide : 6. Creating and Using Basic Fields : Common Field Properties : Set Multiple Selections for List Fields and Table Fields
 
Share this page                  
Set Multiple Selections for List Fields and Table Fields
You can set the selection mode for a list field or table field using the Property Inspector or 4GL code.
To set the selection mode using the Property Inspector
1. Open your frame in the Frame Editor (see Open an Existing Frame).
2. Select the list field or table field on the frame.
3. Click the SelectionType property in the Property Inspector.
4. Select one of the two possible values:
SEL_SINGLE
Specifies that the end user may select only one item at a time
SEL_MULTIPLE
Specifies that the end user may make multiple selections following the rules described in User Interactions)
User Interactions
Selections made with the mouse or keyboard can be contiguous or disjoint. The end user can make single selections by clicking a row without keyboard modifiers or by using keyboard navigation keys (up arrow/down arrow, PgUp/PgDown, or Home/End) without modifiers to navigate to the desired row.
Contiguous Multiple Selections
Contiguous multiple selections can be made by clicking and dragging without modifiers. The Shift key modifier expands the ability to make multiple selections by making use of the concept of an anchor row. Clicking a row without the Shift key modifier moves the anchor to the selected row (even if you subsequently drag to a different row).
Keyboard navigation without the Shift key modifier moves the anchor to the selected row. However, whenever the Shift key is used as a modifier the anchor row remains unchanged. Using the Shift key causes all rows between the anchor row and the row navigated to, to become selected, causing all other rows to become deselected. Therefore, the end user can make contiguous selections by first setting the anchor without the Shift key and then navigating using the Shift key.
Disjointed Multiple Selections
The Ctrl key modifier to the mouse enables disjointed multiple selections. This is because using the Ctrl key modifier does not modify any selections outside of the range of its command. Doing a Ctrl+Click toggles the selection state only of the single row clicked on. Doing a Ctrl+Click+Drag does a contiguous selection (or deselection) of the rows dragged across, but does not affect any other rows.
Disjointed selections using the keyboard require use of Shift+F8 to first change the mode of selection. This causes both the anchor and all current selections to remain fixed while using navigation keys (except the Shift key modifier, which selects or deselects all rows between the anchor and the new row, but leaves all other current selections fixed). In the Shift+F8 selection mode, the Space key toggles the selection state of whichever row has the focus without modifying selections. It also changes the anchor to that row. This mode is toggled back to the usual keyboard mode if the field loses focus or if there are any mouse clicks.
The following table summarizes the result of all end user mouse actions:
Action
Result
Focus
Anchor
Click
The clicked row is selected. All other rows are deselected.
Moves to the clicked row.
Moves to the clicked row.
Shift+Click
Selects all rows between the anchor row and the clicked row (including clicked row). Leaves the anchor row selection state unchanged. Deselects all other rows.
Moves to the clicked row.
Remains where it was.
Ctrl+Click
Toggles the selection state of the clicked row. Leaves all other rows unchanged.
Moves to the clicked row.
Moves to the clicked row.
Shift+Ctrl+Click
Sets selection state of all rows between the anchor row and the clicked row to the same state as the anchor row. All other rows remain unchanged.
Moves to the clicked row.
Remains where it was.
Click+Drag
Selects all rows from BtnDown row to BtnUp row. All other rows are deselected.
Moves to BtnUp row.
Moves to BtnDown row.
Shift+Click+Drag
Same as Shift+Click BtnUp row.
Moves to BtnUp row.
Remains where it was.
Ctrl+Click+Drag
Toggles selection state of BtnDown row. Sets all rows from BtnDown to BtnUp row to same state as BtnDown row. All other rows remain unchanged.
Moves to BtnUp row.
Moves to BtnDown row.
Shift+Ctrl+Click+ Drag
Same as Shift+Ctrl+Click BtnUp row.
Moves to BtnUp row.
Remains where it was.
Scrolling actions using the associated scroll bar do not change existing selections when Selection Type is Multiple. It does, however, change the focus row, so that the focus row remains visible. The default action of scrolling with Selection Type of Single is to change the selection. This can, however, be overridden by setting the ScrollingChangesSelection flag to FALSE.
You can force the table field to be scrolled in a 4GL script in exactly the manner as is currently done by setting the ActiveRow attribute. If the ActiveRow attribute is set to a row that is not currently visible, it is scrolled into view at the top of the table field.
Programming Interface
A row of a list field or a table field can be set to a selected or unselected state by a 4GL statement by setting an appropriate attribute. Setting the selection state of a row yields different results, based on the styles of selection currently in effect. In single selection, setting a row to the select state deselects the previously selected row. Additionally, for a list field, the value of the list field's variable is updated to represent the current selection. For a table field, the attributes CurRow and ActiveRow are updated.
For more information, see the Programming Guide.