Grid Cell - Maple Help

Maplets[Elements]

 GridCell
 specify an entry in a row of a grid layout

 Calling Sequence GridCell(opts)

Parameters

 opts - equation(s) of the form option=value where option is one of halign, height, hscroll, hweight, valign, value, vscroll, vweight, or width; specify options for the GridCell element

Description

 • The GridCell layout element specifies an entry in a row of a grid layout.
 • The contents of the cell are specified by using the value option.
 • The GridCell 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 always, as_needed, or never hscroll and vscroll options left or right halign option string or symbol value option top or bottom valign option

 • A GridCell element can contain BoxLayout, GridLayout, or window body elements to specify the value option.
 • A GridCell element can only be contained in a GridRow element.
 • The following table describes the control and use of the GridCell 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 halign x height x hscroll x hweight x valign x vscroll x vweight x value x width x

 • The opts argument can contain one or more of the following equations that set Maplet application options.
 halign = left, center, right, or full
 Horizontal alignment of the cell contents.  By default, the value is inherited from either the parent GridRow, or if unset, the parent GridLayout, or if unset then defaults to center. The value full, rather than aligning the cell contents, attempts to horizontally stretch the cell contents to fill the cell.
 height = posint
 The number of grid rows the cell spans. By default, the value is 1.
 Note: The height parameter does not control the height of its content, only its position.
 hscroll = never, as_needed, or always
 This option determines when a horizontal scroll bar appears in the grid cell.  By default, the value is never.
 hweight = integer in the range 0..10
 This option specifies the amount of stretch to apply to the column the GridCell appears in when the GridLayout is horizontally resized. A value of 0 (the default) corresponds to no stretching, while a value of 10 (the maximum) corresponds to full stretching. The stretch value for a column in a GridLayout is taken to be the maximum stretch value for all GridCell elements in that column.
 valign = top, center, bottom, or full
 Vertical alignment of the cell contents.  By default, the value is inherited from either the parent GridRow, or if unset, the parent GridLayout, or if unset then defaults to center. The value full, rather than aligning the cell contents, attempts to vertically stretch the cell contents to fill the cell.
 value = window body, BoxLayout, or GridLayout element, or reference to such an element (name or string)
 The Maplet application element that appears in the grid cell.
 vscroll = never, as_needed, or always
 This option determines when a vertical scroll bar appears in the grid cell.  By default, the value is never.
 vweight = integer in the range 0..10
 This option specifies the amount of stretch to apply to the row the GridCell appears in when the GridLayout is vertically resized. A value of 0 (the default) corresponds to no stretching, while a value of 10 (the maximum) corresponds to full stretching. The stretch value for a row in a GridLayout is taken to be the maximum stretch value for all GridCell elements in that row.
 width = posint
 The number of grid cells that the cell spans. By default, the value is 1.
 Note: The width parameter does not control the width of its content, only its position.

Examples

Alignment example:

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{GridLayout}\left(\mathrm{halign}=\mathrm{left},\mathrm{inset}=3,\mathrm{GridRow}\left("Spacing:",\mathrm{GridCell}\left("-----------------"\right)\right),\mathrm{GridRow}\left("Right alignment:",\mathrm{GridCell}\left(\mathrm{Button}\left("Sample",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{right}\right)\right),\mathrm{GridRow}\left("Center alignment:",\mathrm{GridCell}\left(\mathrm{Button}\left("Sample",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{center}\right)\right),\mathrm{GridRow}\left("Left alignment:",\mathrm{GridCell}\left(\mathrm{Button}\left("Sample",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{left}\right)\right),\mathrm{GridRow}\left("Full alignment:",\mathrm{GridCell}\left(\mathrm{Button}\left("Sample",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{full}\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Using height and width:

 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{GridLayout}\left(\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{height}=3,\mathrm{TextBox}\left(\mathrm{width}=5,\mathrm{height}=3\right)\right),\mathrm{GridCell}\left(\mathrm{width}=3,\mathrm{TextBox}\left(\mathrm{width}=15,\mathrm{height}=1\right)\right)\right),\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{height}=2,\mathrm{width}=2,\mathrm{TextBox}\left(\mathrm{width}=10,\mathrm{height}=2\right)\right),\mathrm{GridCell}\left(\mathrm{height}=2,\mathrm{TextBox}\left(\mathrm{width}=5,\mathrm{height}=2\right)\right)\right),\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{width}=4,\mathrm{TextBox}\left(\mathrm{width}=20,\mathrm{height}=1\right)\right)\right)\right)\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Similar layout using bottom row for vertical resize and center column for horizontal resize with multi-line buttons and using 'full' alignment

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{GridLayout}\left(\mathrm{halign}=\mathrm{full},\mathrm{valign}=\mathrm{full},\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{height}=3,\mathrm{Button}\left("l\ne\nf\nt",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right)\right),\mathrm{GridCell}\left(\mathrm{Button}\left("top",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right)\right),\mathrm{GridCell}\left(\mathrm{height}=3,\mathrm{Button}\left("r\ng\nh\nt",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right)\right)\right),\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{height}=2,\mathrm{hweight}=10,\mathrm{Button}\left("OK",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right)\right)\right),\mathrm{GridRow}\left(\mathrm{GridCell}\left(\mathrm{width}=3,\mathrm{vweight}=10,\mathrm{Button}\left("done",\mathrm{onclick}=\mathrm{Shutdown}\left(\right)\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$