Box Layout - Maple Help

Maplets[Elements]

 BoxLayout
 define a box layout

 Calling Sequence BoxLayout(opts, element_content) BoxLayout[refID](opts, element_content)

Parameters

 opts - equation(s) of the form option=value where option is one of background, border, caption, font, inset, reference, vertical, or visible; specify options for the BoxLayout element element_content - any number of BoxCell, BoxColumn, or BoxRow elements refID - name or string; reference to the element

Description

 • The BoxLayout layout element defines a box layout in a Maplet application. A box layout is a relative layout scheme in which you can control where items appear horizontally or vertically relative to other elements. If there is more than one content element, they are displayed in a row.
 • For horizontal control in a box layout, use the BoxRow element. For vertical control in a box layout, use the BoxColumn element.
 • To align BoxColumn and BoxRow elements vertically using the BoxLayout element, you can use the BoxColumn element or specify vertical=true for BoxLayout.
 • The BoxLayout 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 refID reference option string or symbol caption option

 • A BoxLayout element can contain any number of BoxCell, BoxColumn, or BoxRow elements.
 • A BoxLayout element can be contained in a Maplet, GridCell, GridCell2, or Window element, or equation for the layout option in a Window element.
 • The following table describes the control and use of the BoxLayout 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 border x caption x font x halign x inset x reference x valign x vertical x visible x

 • The opts argument can contain one or more of the following equations that set Maplet options.
 background = color
 The color of the highlights of the box layout.  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.
 border = true or false
 Whether the table has a border.  By default, the value is false.
 caption = string
 The text that appears above the box layout.  The caption is visible only if the option border is set to true.
 font = Font element or reference to a Font element (name or string)
 The text font in the caption.
 halign = left, center, right, or none
 Specifies the default horizontal alignment for any BoxRow elements contained in the layout. By default, the value is center. The none option can be used in combination with HorizontalGlue elements for finer control of the layout of cells in a row.
 inset = nonnegint
 The amount of padding that surrounds the elements in the box layout. The default inset is $5$ pixels.
 reference = name or string
 A reference for the BoxLayout element.
 If the reference is specified by both an index, for example, BoxLayout[refID], and a reference in the calling sequence, the index reference takes precedence.
 valign = top, center, bottom, or none
 Specifies the default vertical alignment for any BoxColumn elements contained in the layout. By default, the value is center. The none option can be used in combination with VerticalGlue elements for finer control of the layout of cells in a column.
 vertical = true or false
 Whether the BoxColumn or BoxRow elements are arranged in a vertical column.  By default, the value is false.
 visible = true or false
 Whether the table is visible to the user.  By default, the value is true.

Examples

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{Window}\left('\mathrm{layout}'='\mathrm{BL1}'\right),\mathrm{BoxLayout}\left['\mathrm{BL1}'\right]\left(\mathrm{BoxColumn}\left(\mathrm{BoxRow}\left("Enter text:",\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(\right)\right),\mathrm{Button}\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right)\right)\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

This Maplet application is identical to:

 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left["Enter text:",\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(\right)\right],\mathrm{Button}\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

A Maplet application in which the halign=none option is used in combination with HorizontalGlue to achieve better control over the location of elements in the layout.

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left('\mathrm{halign}'='\mathrm{none}',\mathrm{BoxColumn}\left(\mathrm{BoxRow}\left("Long text label to force alignment usage"\right),\mathrm{BoxRow}\left(\mathrm{Button}\left("Left1",\mathrm{Shutdown}\left(\right)\right),\mathrm{Button}\left("Left2",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right)\right),\mathrm{BoxRow}\left(\mathrm{Button}\left("Left",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right),\mathrm{Button}\left("Right",\mathrm{Shutdown}\left(\right)\right)\right),\mathrm{BoxRow}\left(\mathrm{HorizontalGlue}\left(\right),\mathrm{Button}\left("Right2",\mathrm{Shutdown}\left(\right)\right),\mathrm{Button}\left("Right1",\mathrm{Shutdown}\left(\right)\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$