Combo Box Component - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools[Components]

  

ComboBox

  

generate XML for a ComboBox Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ComboBox( L, opts )

Parameters

L

-

(optional) list; list of strings.

opts

-

(optional) ; one or more keyword options as described below

Options

• 

action : string; A string which parses to one or more valid statements in 1-D Maple Notation. These statements form the Select Action Component Code that executes when the ComboBox selection is manually adjusted.

• 

enabled : truefalse; Indicates whether the component is enabled. The default is true. If enabled is false then the inserted component is grayed out and interaction with it cannot be initiated.

• 

fontcolor : {list(nonnegint),symbol,string}:=[0,0,0] ; Specifies the font color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [0,0,0] which corresponds to black.

• 

identity : {name,string}; The reference name of the component.

• 

selected : string; The initially selected item. By default no item is selected.

• 

tooltip : string; The text that appears when the mouse pointer hovers over the component.

• 

visible : truefalse; Indicates whether the component is visible. The default is true.

Description

• 

The ComboBox command in the Component Constructors package returns an XML function call which represents a ComboBox Component.

• 

The generated XML can be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document can be inserted into the current document using the InsertContent command.

Examples

withDocumentTools:

withDocumentTools:-Components:

withDocumentTools:-Layout:

LA,B,C

LA,B,C

(1)

Executing the ComboBox command produces a function call.

SComboBoxL,identity=ComboBox0

S_XML_EC-ComboBoxid=ComboBox0,enabled=true,fontcolor=[0,0,0],visible=true,A,B,C

(2)

By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.

xmlWorksheetGroupInputTextfieldS:

That XML representation of a worksheet can be inserted directly.

InsertContentxml:

SComboBoxL,identity=ComboBox0,selected=B,tooltip=My example ComboBox:

xmlWorksheetGroupInputTextfieldS:

The previous example's call to the InsertContent command inserted a component with identity "ComboBox0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "ComboBox0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

The return value of the following call to InsertContent is a table which can be used to reference the substituted identity of the inserted component.

lookupInsertContentxml,output=table

lookuptableComboBox0=ComboBox1

(3)

lookupComboBox0

ComboBox1

(4)

GetPropertylookupComboBox0,value

B

(5)

The next example makes use of action code for a ComboBox. When the selected item is manually altered the action code is executed.

The action code updates a PlotComponent with identity "Plot0", which will be an additional part of the inserted content. This component will be constructed using the Plot Component constructor.

pplot3dxsiny,x=10..10,y=2π..2π,shading=zhue:

PComponents:-Plotp,identity=Plot0:

The action code consists of multi-line statements supplied as a string.

actioncodeDocumentTools:-SetProperty(':-Plot0',value,\n plot3d(x*sin(y), x=-10..10, y=-2*Pi..2*Pi,\n shading=parse(DocumentTools:-GetProperty(':-ComboBox0',value))));:

SComboBoxxy,xyz,z,zgrayscale,zhue,none,identity=ComboBox0,selected=zhue,action=actioncode,fontcolor=DarkBlue,tooltip=The shading choice:

xmlWorksheetGroupInputTextfieldP,GroupInputTextfieldS:

Following insertion an item in the ComboBox may be manually selected, which causes the respective action code to execute and the "Plot0" component to be updated.

InsertContentxml:

The ComboBox component in the previous example is constructed by supplying identity="ComboBox0" as an option. But the first example on this page had already inserted content with a component with that identity. Hence the identity of the ComboBox in the last example may be replaced at insertion time. Note that literal instances of "ComboBox0" are also replaced in all component action code of the inserted content in the last example. In particular the replacement of the literal instance of "ComboBox0" in the actioncode string will match the identity replacement. This allows the action code to function as intended, with component identities replaced consistently. This can be confirmed by selecting the inserted ComboBox and viewing the component name in the Context Panel and by clicking Edit Select Code... to view the Code Editor for this component.

Compatibility

• 

The DocumentTools:-Components:-ComboBox command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The DocumentTools:-Components:-ComboBox command was updated in Maple 2016.

• 

The fontcolor option was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

Component Code

Component Constructors

DocumentTools

Embedded Components

XMLTools