|
Calling Sequence
|
|
DropDownBox(opts, dropdown_box_content)
DropDownBox[refID](opts, dropdown_box_content)
|
|
Parameters
|
|
opts
|
-
|
equation(s) of the form option=value where option is one of background, enabled, font, foreground, halign, height, onchange, reference, tooltip, valign, value, visible, or width; specify options for the DropDownBox element
|
dropdown_box_content
|
-
|
any number of Item elements, or a list of strings or symbols; items that appear in the drop-down box
|
refID
|
-
|
name or string; reference to the element
|
|
|
|
|
Description
|
|
•
|
The DropDownBox window body element defines a drop-down box in a Maplet application. A drop-down box allows the user to select an item from a predefined list. The selected item is returned as a list containing a string.
|
•
|
The DropDownBox element features can be modified by using options. To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are assigned by default.
|
Elements, Symbols, or Types
|
Assumed Option or Content
|
|
|
Font element
|
font option
|
refID
|
reference option
|
string or symbol
|
value option
|
|
|
|
|
•
|
A drop-down box is different from a combo box. The user must select an item from the drop-down box's predefined list. A combo box allows the user to enter other text.
|
•
|
A DropDownBox element can contain Item elements. A DropDownBox element can contain Action or command elements to specify the onchange option and a Font element to specify the font option.
|
•
|
A DropDownBox element can be contained in a Maplet or BoxLayout element, or Maplet element in a nested list representing a box layout.
|
•
|
The following table describes the control and use of the DropDownBox element options.
|
|
An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).
|
|
An x in the R column indicates that the option is required in the calling sequence.
|
|
An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.
|
|
An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.
|
Option
|
I
|
R
|
G
|
S
|
|
|
|
|
|
appenditem*
|
|
|
|
x
|
background
|
x
|
|
x
|
x
|
enabled
|
x
|
|
x
|
x
|
font
|
x
|
|
x
|
x
|
foreground
|
x
|
|
x
|
x
|
halign
|
x
|
|
|
|
height
|
x
|
|
|
|
itemlist*
|
|
|
x
|
x
|
onchange
|
x
|
|
|
|
reference
|
x
|
|
|
|
tooltip
|
x
|
|
x
|
x
|
valign
|
x
|
|
|
|
value
|
x
|
|
x
|
x
|
visible
|
x
|
|
x
|
x
|
width
|
x
|
|
|
|
|
|
|
|
|
|
|
|
* appenditem appends an item to the list of items in the drop-down box. Its syntax is refID(appenditem)="text", where refID is a reference to the drop-down box.
|
|
* itemlist overwrites the existing list. Its syntax is Maplets:-Tools:-Set(refID(itemlist)=[item1, item2, ..., itemn]), where refID is a reference to the drop-down box and item1, item2, ..., itemn are the new items for the drop-down box.
|
•
|
The opts argument can contain one or more of the following equations that set Maplet application options.
|
|
The color of the drop-down box. This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
|
|
Whether an item from the drop-down box can be selected. If enabled is set to false, the drop-down box is dimmed, and any action associated with it cannot be initiated. By default, the value is true.
|
|
font = Font element or reference to a Font element (name or string)
|
|
The text font in the drop-down box.
|
|
The text color in the drop-down box. This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
|
|
halign = left, center, or right
|
|
Specifies the horizontal alignment for the drop-down box contents. By default, this is left.
|
|
The height in pixels. By default, the drop-down box is sized to fit its content. When both the height and width are set to zero, this tells the drop-down box to size itself based on the layout instead of the content. This means, for example, that when present in a GridLayout using full alignment, the combo box will size itself to fit the GridCell.
|
|
onchange = Action or command element, or reference to an Action element (name or string)
|
|
The action that occurs when the value of the drop-down box changes.
|
|
reference = name or string
|
|
A reference for the DropDownBox element.
|
|
If the reference is specified by both an index, for example, DropDownBox[refID], and a reference in the calling sequence, the index reference takes precedence.
|
|
The text that appears in the tooltip help window.
|
|
valign = top, center, or bottom
|
|
Specifies the vertical alignment for the drop-down box contents.
|
|
The initial value of the drop-down box. If no value is specified, or if the value is not an item in the drop-down box, the initial value is the first item specified in dropdown_box_content.
|
|
Whether the drop-down box is visible to the user. By default, the value is true.
|
|
The width in pixels. By default, the drop-down box is sized to fit its content. When both the height and width are set to zero, this tells the drop-down box to size itself based on the layout instead of the content. This means, for example, that when present in a GridLayout using full alignment, the combo box will size itself to fit the GridCell.
|
|
|
Examples
|
|
>
|
|
>
|
|
The following example shows how to create a maplet dialog that uses a predefined procedure to adaptively set properties of entry fields.
First, a procedure is defined which sets text fields to active or not active depending on the choice from the drop-down list. The label is also modified accordingly.
>
|
|
>
|
ElementController := proc()
local val;
val := Maplets:-Tools:-Get( 'DDB1' );
if val in { "1" } then
Maplets:-Tools:-Set( 'IF1'( 'enabled' ) = 'true', 'IF2'( 'enabled' ) = 'false', 'LB1'( 'caption' ) = "Active", 'LB2'( 'caption' ) = "Field 2" );
else
Maplets:-Tools:-Set( 'IF1'( 'enabled' ) = 'false', 'IF2'( 'enabled' ) = 'true', 'LB1'( 'caption' ) = "Field 1", 'LB2'( 'caption' ) = "Active" );
end if;
return NULL;
end proc:
|
Next, the maplet dialog is defined:
>
|
|
>
|
|
|
|
|