DocumentTools[Components]
Label
generate XML for a Label Component
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Label( caption, opts )
caption
-
(optional) string:="Label"; the caption on the label
opts
(optional) ; one or more keyword options as described below
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.
height : posint; The height in pixels of the component.
identity : {name,string}; The reference name of the component.
image : {string,Matrix,Array}; Image to be displayed on the component, specified as either the name of an external image file or a Matrix or Array as recognized by commands in the ImageTools package. The caption parameter and the image option are mutually exclusive; only one can be supplied.
tooltip : string; The text that appears when the mouse pointer hovers over the component. The default is the empty string (no tooltip).
visible : truefalse; Indicates whether the component is visible. The default is true.
width : posint; The width in pixels of the component.
The Label command in the Component Constructors package returns an XML function call which represents a Label 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.
with⁡DocumentTools:
with⁡DocumentTools:-Layout:
with⁡DocumentTools:-Components:
Executing the Label command produces a function call.
S≔Label⁡My Label,identity=Label0
S≔_XML_EC-Label⁡id=Label0,caption=My Label,enabled=true,visible=true,fillcolor=[255,255,255],fontcolor=[0,0,0]
By using commands from the Layout Constructors package a nested function call can be produced which represents a worksheet.
xml≔Worksheet⁡Group⁡Input⁡Textfield⁡S:
That XML representation of a worksheet can be inserted directly.
InsertContent⁡xml:
S≔Label⁡New Label,identity=Label0,tooltip=new label:
The previous example's call to the InsertContent command inserted a component with identity "Label0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "Label0" 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.
lookup≔InsertContent⁡xml,output=table
lookup≔table⁡Label0=Label1
lookupLabel0
Label1
GetProperty⁡lookupLabel0,caption
New Label
img≔cat⁡kernelopts⁡datadir,/images/antennas.jpg:
L≔Label⁡image=img,identity=Label17,width=120,height=120:
InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡L:
img≔Array⁡1..60,1..40,1..3,i,j,k↦`if`⁡k=3,j40,0,datatype=float8,order=C_order:
L≔Label⁡image=img,identity=Label17:
L≔Label⁡image=img,identity=Label17,width=70,height=20:
S≔Label⁡ My Label ,fillcolor=LightBlue,fontcolor=Blue,width=12:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡S:
The DocumentTools:-Components:-Label command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
The DocumentTools:-Components:-Label 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
XMLTools
Download Help Document