Single Choice List Gadgets
- Last UpdatedJan 09, 2024
- 2 minute read
You can set and get the current selection in a single-choice list using the display-text, replacement text, or .val member. For example:
!This.List.val =2 ‑ selects second list field
!This.List.Select( 'Dtext', 'Coffee' )
!This.List.Select( 'Rtext', 'drink4' )
!fieldNumber = !This.List.val
!Rtext = !This.List.selection()
!Dtext = !This.List.selection(‘Dtext’)
Zero-Selections and Single Choice List Gadgets
You can also define a single-choice list-gadget to allow zero-selections..
The list syntax allows you to define the gadget with the SINGLE ZEROSELECTIONS keyword to indicate that the list is single choice with no mandatory selected field, for example,
list .List |Cars| Anchor all single zerosel width 25 length 10
The val member now allows programmatic de-selection of the current field.
For Single choice lists the keyword NORESELECT disables UnSelect and Select events when the currently selected field is clicked with the mouse, for example:
list .l1 |List gadget| zeroSel noReselect width 15 length 5 tooltip 'single choice list'
For ZeroSelection lists it is now possible to interactively deselect the selected field by clicking in unused rows or after the last column.
Single choice List gadgets support UNSELECT events. Typically when a field is selected, an UNSELECT event is raised for the previously selected field (if any) and then a SELECT event is raised for the new field. An UNSELECT event is raised whenever a selected field is interactively deselected.
Notes:
-
UNSELECT events are not notified to PML unless an open callback has been specified (so that SELECT and UNSELECT events can be differentiated).
-
Typically the UNSELECT action allows Appware to manage consequences of deselection for any dependent gadgets or forms.
-
It is recommend that you do not change the List's selection programmatically in an UNSELECT event.
See the Software Customization Reference Manual for further information.