Button - Maple Help

Maplets[Elements]

 Button
 define a button

 Calling Sequence Button(opts) Button[refID](opts)

Parameters

 opts - equation(s) of the form option=value where option is one of background, caption, enabled, font, foreground, halign, height, image, onclick, reference, tooltip, valign, visible, or width; specify options for the Button element refID - name or string; reference to the element

Description

 • The Button window body element defines a button in a Maplet application.

 • The Button element features can be modified by using options.  To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are, by default, assigned.

 Elements, Symbols, or Types Assumed Option or Content Action or command elements onclick option Font element font option refID reference option string or symbol caption option

 • A Button element can contain Action or command elements to specify the onclick option, a Font element to specify the font option, and an Image element to specify the image option.
 • A Button element can be contained in a Maplet or BoxLayout element, or Maplet element in a nested list representing a box layout.
 • The following table describes the control and use of the Button element options.
 An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).
 An x in the R column indicates that the option is required in the calling sequence.
 An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.
 An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.

 Option I R G S background x x x caption x x x x enabled x x x font x x x foreground x x x halign x height x image x x onclick x x reference x tooltip x x x valign x visible x x x width x

 • The opts argument can contain one or more of the following equations that set Maplet application options.
 background = color
 The color of the button.  This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
 caption = string
 The caption that appears on the button.  The caption can have a mnemonic key or access key associated with it.  For more information, see Maplets Mnemonic Key.
 enabled = true or false
 Whether a button can be clicked.  If enabled is set to false, the button is dimmed, and any action associated with it cannot be initiated.  By default, the value is true.
 font = Font element or reference to a Font element (name or string)
 A reference to a Font element specifying the font of the button text.
 foreground = color
 The color of the text on the button.  This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
 halign = left, center, or right
 Specifies the horizontal alignment for text or an image inside the button.
 height = posint
 The button height in pixels. By default the button is sized to fit its content.
 image = Image element or reference to an Image element (name or string)
 A reference to an Image element.
 onclick = Action or command element, or reference to an Action element (name or string)
 The action that occurs when the button is clicked.
 reference = name or string
 A reference for the Button element.
 If the reference is specified by both an index, for example, Button[refID], and a reference in the calling sequence, the index reference takes precedence.
 tooltip = string or symbol
 The text that appears in the tooltip help window.
 visible = true or false
 Whether the button is visible to the user.  By default, the value is true.
 valign = top, center, or bottom
 Specifies the vertical alignment for text or an image inside the button.
 width = posint
 The button width in pixels. By default the button is sized to fit its content.

Examples

This Maplet application has two buttons. If the first button is clicked, the Maplet application closes and returns "true". If the second button is clicked, the Maplet application closes and returns NULL.

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left["Select one:",\left[\mathrm{Button}\left("OK",\mathrm{Shutdown}\left("true"\right)\right),\mathrm{Button}\left("Cancel",\mathrm{Shutdown}\left(\right)\right)\right]\right]\right):$
 > $\mathrm{result}≔\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$