Next Previous Up Top Contents Index

7.2.3 Collection gadgets

7.2.3.4 Lists

A <list-box>, although it has a different appearance than a <radio-box>, shares many of the same characteristics:

make(<list-box>, items: #(1, 2, 3));

Figure 7.10 A list box

As with other boxes, gadget-value is used to return and set the selection in the box, and gadget-items is used to return and set the items in the box.

Like button boxes, list boxes can be specified as either single, multiple, or no selection when they are created, using the selection-mode: init-keyword. Unlike button boxes, different values for selection-mode: do not produce gadgets that are different in appearance; a single selection list box is visually identical to a multiple selection list box.

Two init-keywords let you specify different characteristics of a list box.

The borders: init-keyword controls the appearance of the border placed between the list itself, and the rest of the gadget. It takes a number of symbolic arguments, the most useful of which are as follows:

#"sunken"

The list looks as if it is recessed compared to the surrounding edge of the gadget.

#"raised"

The list looks as if it is raised compared to the surrounding edge of the gadget.

#"groove"

Rather than raising or lowering the list with respect to its border, a groove is drawn around it.

#"flat"

No border is placed between the list and the edges of the gadget.

The scroll-bars: init-keyword controls how scroll bars are placed around a list box. It takes the following values:

#"vertical"

The list box is given a vertical scroll bar.

#"horizontal"

The list box is given a horizontal scroll bar.

#"both"

The list box is given both vertical and horizontal scroll bars.

#"none"

The list box is given no scroll bars.

#"dynamic"

The list box is given vertical and horizontal scroll bars only when they are necessary because of the amount of information visible in the list.

The <option-box> class is another list control that you will frequently use in your applications. This gadget is usually referred to in Microsoft documentation as a drop-down list box. It differs from a standard list box in that it looks rather like a text field, with only the current selection visible at any one time. In order to see the entire list, the user must click on an arrow displayed to the right of the field.

Figure 7.11 An option box

make(<option-box>, items: #("&Red", "&Green", "&Blue"));

Notice the use of the & character to denote a keyboard shortcut. Pressing the R key when the option box has focus selects Red, pressing G selects Green, and pressing B selects Blue.

Like list boxes, option boxes also support the borders: and scroll-bars: init-keywords.

The <combo-box> class is visually identical to the <option-box> class, except that the user can type into the text field portion of the gadget. This is a useful way of allowing the user to specify an option that is not provided in the list, and a common technique is to add any new options typed by the user into the drop-down list part of the gadget for future use.

Like list boxes and option boxes, combo boxes support the borders: and scroll-bars: init-keywords.


Building Applications Using DUIM - 26 May 1999

Next Previous Up Top Contents Index