define a combo box - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Maplets : Elements : Window Body Elements : Maplets/Elements/ComboBox

Maplets[Elements][ComboBox] - define a combo box

Calling Sequence

ComboBox(opts, combo_box_content)

ComboBox[refID](opts, combo_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 ComboBox element

combo_box_content

-

any number of Item elements, or a list of strings or symbols; items that appear in the combo box

refID

-

name or string; reference to the element

Description

• 

The ComboBox window body element defines a combination box in a Maplet. A combination box is similar to both a drop-down box and text box: the user can enter text or select an item from the list. The selected item is returned as a list containing a string.

  

 

• 

The ComboBox 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, by default, assigned.

Elements, Symbols, or Types

Assumed Option or Content

 

 

Font element

font option

refID

reference option

string or symbol

value option

 

 

• 

With a combo box, the user can enter text or select from the list, whereas with a drop-down box, the user must select from the list.

• 

A ComboBox element can contain Item elements. A ComboBox element can contain Action or command elements to specify the onchange option or a Font element to specify the font option.

• 

A ComboBox 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 ComboBox 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

editable

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 combo box. Its syntax is refID(appenditem)="text", where refID is a reference to the combo box.

  

* itemlist overwrites the existing list.  Its syntax is Maplets:-Tools:-Set(refID(itemlist)=[item1, item2, ..., itemn]), where refID is a reference to the combo box and item1, item2, ..., itemn are the new items for the combo box.

• 

The opts argument can contain one or more of the following equations that set Maplet application options.

  

 

  

background = color

  

The color of the non-entry parts of the combo box (the text entry area is always white).  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.

  

 

  

enabled = true or false

  

Whether an item from the combo box can be selected.  If enabled is set to false, the combo 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 combo box.

  

 

  

foreground = color

  

The text color in the non-entry parts of the combo box (the text entry area always has black text).  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 combo box contents. By default this is left.

  

 

  

height = nonnegint

  

The height in pixels. By default the combo box is sized to fit its content. When both the height and width are set to zero, this tells the combo 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 combo box changes.

  

 

  

reference = name or string

  

A reference for the ComboBox element.

  

If the reference is specified by both an index, for example, ComboBox[refID], and a reference in the calling sequence, the index reference takes precedence.

  

 

  

tooltip = string

  

The text that appears in the tooltip help window.

  

 

  

valign = top, center, or bottom

  

Specifies the vertical alignment for the combo box contents.

  

 

  

value = string or symbol

  

The initial value of the combo box.  If no value is specified, the initial value is the first item specified in combo_box_content.

  

Note: Unlike DropDownBox and ListBox elements, the ComboBox element can use a value that is not in combo_box_content specified as the initial value.

  

 

  

visible = true or false

  

Whether the combo box is visible to the user.  By default, the value is true.

  

 

  

width = nonnegint

  

The width in pixels. By default the combo box is sized to fit its content. When both the height and width are set to zero, this tells the combo 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

withMaplets[Elements]:

maplet:=MapletPick or enter your favorite Canadian city: ,ComboBox'CoB1'Regina,sortWaterloo,Ottawa,Victoria,Edmonton,Regina,Winnipeg,St. Catharines,Toronto,Quebec City,Fredericton,Halifax,Charlottetown,St. John's,Whitehorse,Yellowknife,Iqaluit,lexorder,ButtonOK,Shutdown'CoB1',ButtonCancel,Shutdown:

Maplets[Display]maplet

See Also

Maplets/CommandElements, Maplets/WindowBodyElements, Maplets[Display], Maplets[Elements], Maplets[Elements][Action], Maplets[Elements][Button], Maplets[Elements][DropDownBox], Maplets[Elements][Font], Maplets[Elements][Item], Maplets[Elements][Maplet], Maplets[Elements][SetOption], Maplets[Elements][Shutdown], Maplets[Tools][Get], Maplets[Tools][Set], Overview of Maplet Applications, plot[color]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam