Next Previous Up Top Contents Index

7.2.3 Collection gadgets

7.2.3.1 Useful properties of collection gadgets

All collection gadgets share certain essential properties. These can either be specified when an instance of a gadget is created, using an init-keyword, or set interactively via a slot value.

gadget-items

This slot contains a Dylan collection representing the contents of a collection gadget.

gadget-label-key

The label key is a function that is used to compute the label of each item in a collection gadget, and therefore defines the "printed representation" of each item. If gadget-label-key is not explicitly defined for a collection gadget, its items are labeled numerically.
gadget-value-key

Similar to the label key, the value key is used to compute a value for each item in a collection gadget. The gadget value of a collection gadget is the value of any selected items in the collection gadget.
gadget-selection-mode

The selection mode of a collection gadget determines how many items in the gadget can be selected at any time. This takes one of three symbolic values: #"single" (only one item can be selected at any time), #"multiple" (any number of items can be selected at once), #"none" (no items can be selected at all).
Note that you can use gadget-selection-mode to read the selection mode of a gadget, but you cannot reset the selection mode of a gadget once it has been created. Instead, use the selection-mode: init-keyword to specify the selection mode when the gadget is created.
Generally, different subclasses of collection gadget specify this property automatically. For example, a radio box is single selection, and a check box is multiple selection.

To specify any of these slot values as an init-keyword, remove the gadget- prefix. Thus, the gadget-value-key slot becomes the value-key: init-keyword.


Building Applications Using DUIM - 26 May 1999

Next Previous Up Top Contents Index