List Box Component - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Embedded Components : ListBoxComponent

List Box Component

Insert a list box in a Standard Maple worksheet or document.

 

Description

Component Palette Image

List Box Properties

List Box Example

Description

• 

The list box component performs an action or a series of actions to communicate with other embedded components when an item from the list box is selected, although assigning an action to a component is not required.

• 

To perform an action when an item from a list box is selected, right-click (Control-click for Macintosh) the list box, and then select Edit Select Action to open the Code Editor dialog for the list box. Enter the commands you want to perform in the Code Editor dialog.

• 

You need to specify one or more embedded components that will display the output once an item from the list box is selected. For more information, see the List Box Component Example on this page.

• 

The list box component is customized by setting options in the ListBox Properties. To open the ListBox Properties, right-click (Control-click for Macintosh) the list box, and then select Component Properties. Actions are associated with components using routines in the DocumentTools package.

• 

The Name property is used to reference the list box when using the routines from the DocumentTools package.

• 

To populate the list box with entries, select the Edit button beside Item List. In the List Editor that displays, add the first item by double-clicking the text field and edit this region. To add additional items, click the Add button to display an additional text field and proceed to edit the entry as illustrated in the previous step. Once you have populated the list box, select the drop-down menu beside Selected Item and choose the item that will be the default item highlighted in the list box.

Component Palette Image

List Box Properties

• 

The following table describes the control and use of the list box component options.

  

An x in the G column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.

  

An x in the S column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.

Option           G  S  Option Type   
                             
enabled          x  x  true or false
fillcolor        x  x  color         
fontcolor        x  x  color         
itemList         x  x  list or set   
selectmultiple   x  x  true or false
selectedItemList x  x  list or set   
tooltip          x  x  string        
value            x  x  string        
visible          x  x  true or false
                              

  

enabled 

  

Whether the component is enabled. If enabled is set to false, the component is grayed out and any action associated with it cannot be initiated. By default, the value is true.

  

fillcolor

  

Specifies the background color of the component. The color can be given by RGB values (a list of three integers between 0 and 255) or a string representing a color name, for example, [255,0,0] or “Red”. The default value is [255,255,255] which corresponds to white.

  

fontcolor

  

Specifies the font color of the component.  The default value is [0,0,0] which corresponds to black.

  

itemList 

  

The set of items provided in the List Box.

  

selectmultiple 

  

Indicates whether selecting multiple items is permitted. By default, the value is false.

  

selectedItemList 

  

The set of all items which are currently selected.

  

tooltip 

  

The text that appears when the user hovers the mouse over the list box.

  

value 

  

The selected item, or if multiple items are selected, the first selected item.

  

visible 

  

Specifies if the list box is visible. By default, the value is true.

List Box Example

Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.

This example displays a list of colors in a List Box component. When you click on a color in the list box, the color of curve in the Plot component changes.

To insert the components and add the colors to the list box:

1. 

Insert a List Box and a Plot component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.

2. 

Right-click (Control-click for Macintosh) the list box component, and then select Component > Component Properties.

3. 

Click the Edit button of the Item List field.

4. 

Double-click the first row and replace ListBox with blue.

5. 

Click Add, double-click the new field, and then replace the default entry with red.

6. 

Repeat step 5 and add the following items to the list: black, green, magenta, and yellow. When finished, click OK to close the List Editor.

7. 

Click OK to close the ListBox Properties dialog.

To have a list box item selection change the color of the plot of sin(x):

1. 

Right-click (Control-click for Macintosh) the list box, and then select Edit Select Action.

This launches the Code Editor dialog with preset statements and additional information on how to program actions between embedded components.

2. 

Before the end use; statement in the dialog, enter the following command:

Do(%Plot0=plot(sin(x), x=0..10, color=%ListBox0));

Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).

3. 

From the File menu, select Save Code to accept all changes.

4. 

From the File menu, select Close Code Editor.

When you select an item from the list box, the color of the plot changes to the selection.

  

  

 

  

You can verify the syntax of the embedded component action by executing the command in the worksheet.

DocumentTools[Do](%Plot0 = plot(sin(x), x = 0..10, color = %ListBox0));

See Also

DocumentTools

DocumentTools[Do]

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents

PlotComponent

updates,Maple2015,EmbeddedComponents

 


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