Next Previous Up Top Contents Index

8.11 DUIM-Gadgets Module

<collection-gadget>

Open abstract class

Summary

The class of all gadgets that contain collections.

Superclasses

<value-gadget>

Init-keywords

items:
An instance of type <sequence>. Default value: #[].

label-key:
An instance of type <function>.

value-key:
An instance of type <function>. Default value: identity.

test:
An instance of type <function>. Default value: ==.

selection:
An instance of type limited(<sequence>, of: <integer>). Default value: #[].

selection-mode:

An instance of type one-of(#"single", #"multiple", #"none"). Default value: #"single".

key-press-callback:

An instance of type false-or(<command>, <function>).

Library

duim-gadgets

Module

duim-gadgets

Description

The class of all gadgets that can contain collections.

The items: init-keyword is used to specify the collection of items that the collection gadget contains.

The label-key: and value-key: init-keywords are functions that are used to calculate the labels and the value of the gadget respectively.

The value of a collection gadget is determined by calling the value key of the gadget on each selected item in the gadget. The "printed representation" of a collection gadget is determined by calling the label key of the gadget on each item.

By default, the label key returns the numeric label of the gadget items (for example, the buttons in a button box would be labeled 1, 2, 3, and so on). In general, the label key can be trusted to "do the right thing" by default.

By default, the value key returns the collection gadget itself.

Note also that the gadget-value method for collection gadgets is different for single and multiple selection gadgets. For single selection, the item that is selected is returned. For multiple selection, a sequence of the selected items is returned.

The test: init-keyword is the function used to test whether two items of the collection are considered identical.

The selection: init-keyword is available only to those subclasses of <collection-gadget> that contain items that may be selected. The selection is a collection containing the selected keys from the items collection.

Subclasses of <collection-gadget> that can have selections are: <list-box>, <option-box>, <list-control>, <tree-control>, <table-control>, <radio-box>, <check-box>, <check-menu-box>, <radio-menu-box>, <combo-box>.

The key-press-callback: init-keyword lets you specify a key-press callback. This type of callback is invoked whenever a key on the keyboard is pressed while the gadget has focus. It applies only to graph controls, list controls, tab controls, and table controls. See gadget-key-press-callback, page 567, for a fuller description of key-press callbacks.

Operations

gadget-items gadget-items-setter gadget-key-press-callback gadget-key-press-callback-setter gadget-label-key gadget-selection gadget-selection-mode
gadget-selection-setter gadget-test gadget-value-key

See also

<button-box>, page 535

<check-box>, page 537

<check-menu-box>, page 539

<combo-box>, page 544

<list-box>, page 599

<list-control>, page 601

<option-box>, page 622

<radio-box>, page 630

<radio-menu-box>, page 632

<table-control>, page 666

<tree-control>, page 679


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index