Label Component - Maple Programming Help

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

Label Component

Insert a label in a Standard Maple worksheet or document.

Description

 • The label component can display a caption or an image.
 • The label component is customized by setting options in Label Properties. To display Label Properties, right-click (Control-click for Macintosh) the embedded component and select Component Properties. Actions are associated with components using routines in the DocumentTools package.
 • The Name property is used to reference the label when using the routines from the DocumentTools package.
 Component Palette Image

Label Properties

 • The following table describes the control and use of the label 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

caption               x  x  string
enabled               x  x  true or false
fillcolor             x  x  color
fontcolor             x  x  color

image                    x  name or string
pixelHeight           x  x  positive integer
pixelWidth            x  x  positive integer
tooltip               x  x  string
useSpecifiedSize      x  x  true or false

useSpecifiedWidth     x  x  true or false
visible               x  x  true or false
visibleCharacterWidth x  x  positive integer

 caption
 The text that appears in the label.  By default, the value is Label.
 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.
 image
 The image that appears on the label.
 pixelHeight
 The height of the image in pixels.
 pixelWidth
 The width of the image in pixels.
 tooltip
 The text that appears when the user hovers the mouse over the label.
 useSpecifiedSize
 Whether the specified size of the image is used. By default, the value is false.
 useSpecifiedWidth
 Whether the specified character width is used. By default, the value is false.
 visible
 Specifies if the label is visible. By default, the value is true.
 visibleCharacterWidth
 The number of characters that appear in the label. This option only applies when useSpecifiedWidth is set.

Label Component Examples

 Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.
 This example launches Student[Calculus1][DiffTutor] and returns the derivative of the function to an embedded Mathematical Expression component.

To insert the components and set the caption for the label component:

 1 Insert a Label component, a Button component, and a Mathematical Expression component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
 2 Right-click the Label component, and then select Component Properties.
 3 In the Caption field, enter Differentiation Help, and then click OK.

To launch the differentiation tutor when you click on the button component:

 1 Right-click the Button component, and then select Component Properties.
 2 In the Caption field, enter Run Tutor, and then click OK.
 3 Right-click (Control-click for Macintosh) on Run Tutor, and then select Edit Click Action.

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

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

a := Student[Calculus1][DiffTutor](sin(x)*cos(x));

Do(%MathContainer0=a);

Note: Ensure the component name (that is, MathContainer0) is correct.

 5 From the File menu, select Save Code to accept all changes.
 6 From the File menu, select Close Code Editor.

When you click on Run Tutor, the Student[Calculus][DiffTutor] dialog opens. From here you can solve a differentiation problem step-by-step. When you close the dialog, the result from the tutor is displayed in the math expression component.

 You can verify the syntax of the embedded component action by executing the command in the worksheet.
 > a:=Student[Calculus1][DiffTutor](sin(x)*cos(x)):
 > DocumentTools[Do](%MathContainer0 = a);
 $\frac{{ⅆ}}{{ⅆ}{x}}\left({\mathrm{sin}}\left({x}\right){\mathrm{cos}}\left({x}\right)\right){=}{{\mathrm{cos}}\left({x}\right)}^{{2}}{-}{{\mathrm{sin}}\left({x}\right)}^{{2}}$ (4.1)