List 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]

  

ListBox

  

generate XML for a ListBox Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ListBox(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 ListBox 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.

• 

fillcolor : {list(nonnegint),symbol,string}:=[255,255,255] ; Specifies the background 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 [255,255,255] which corresponds to white.

• 

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 ListBox command in the Component Constructors package returns an XML function call which represents a ListBox 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 ListBox command produces a function call.

SListBoxL,identity=ListBox0

S_XML_EC-Listid=ListBox0,enabled=true,visible=true,fillcolor=[255,255,255],fontcolor=[0,0,0],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:

SListBoxL,identity=ListBox0,selected=B,tooltip=My example ListBox:

xmlWorksheetGroupInputTextfieldS:

The previous example's call to the InsertContent command inserted a component with identity "ListBox0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "ListBox0" 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

lookuptableListBox0=ListBox1

(3)

lookupListBox0

ListBox1

(4)

GetPropertylookupListBox0,value

B

(5)

The next example makes use of action code for a ListBox. 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.

pplotx2sinx,x=2π..2π,color=blue:

PComponents:-Plotp,identity=Plot0:

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

actioncodeDocumentTools:-SetProperty(':-Plot0',value,\n plot(x^2*sin(x), x=-2*Pi..2*Pi,\n color=parse(DocumentTools:-GetProperty(':-ListBox0',value))));:

SListBoxred,black,blue,green,magenta,yellow,identity=ListBox0,selected=red,action=actioncode,tooltip=The color choice,fillcolor=LightYellow,fontcolor=DarkBlue:

xmlWorksheetGroupInputTextfieldP,GroupInputTextfieldS:

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

InsertContentxml:

The ListBox component in the previous example is constructed by supplying identity="ListBox0" 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 ListBox in the last example can be replaced at insertion time. Note that literal instances of "ListBox0" 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 "ListBox0" 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 ListBox 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:-ListBox command was introduced in Maple 2015.

• 

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

• 

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

• 

The fillcolor and fontcolor options were 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

Layout Constructors

XMLTools