 Maplets[Elements] - Maple Programming Help

Home : Support : Online Help : Programming : Maplets : Elements : Layout Elements : Maplets/Elements/HorizontalGlue

Maplets[Elements]

 HorizontalGlue
 specify spacing in a row of a box layout

 Calling Sequence HorizontalGlue()

Description

 • The HorizontalGlue layout element adds flexible spacing in its location in a BoxRow of a box layout.
 When a row is initially sized, any extra space not consumed by the visible elements is equally distributed to all HorizontalGlue elements in that row. This includes any HorizontalGlue elements that are implicitly defined through the halign argument for the BoxRow or the elements of the BoxRow.
 When the row is resized (for example, by resizing the window) the change width of the BoxRow is applied to the HorizontalGlue elements equally when possible.
 • The HorizontalGlue layout element takes no additional options.
 • A HorizontalGlue element can only be contained in a BoxRow element, and is most useful when the BoxRow has been specified with halign=none, allowing greater control of spacing of the elements within the row.

Examples

Alignment with halign.

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left(\mathrm{BoxColumn}\left(\mathrm{BoxRow}\left(\mathrm{Label}\left("This is a very long label to force additional space"‖"so the alignment of the buttons below are relevant"\right)\right),\mathrm{BoxRow}\left(\mathrm{BoxCell}\left(\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{left}\right),\mathrm{BoxCell}\left(\mathrm{Button}\left("Quit2",\mathrm{Shutdown}\left(\right)\right),\mathrm{halign}=\mathrm{right}\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Same alignment using HorizontalGlue.

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left(\mathrm{BoxColumn}\left(\mathrm{BoxRow}\left(\mathrm{Label}\left("This is a very long label to force additional space"‖"so the alignment of the buttons below are relevant"\right)\right),\mathrm{BoxRow}\left(\mathrm{halign}=\mathrm{none},\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right),\mathrm{Button}\left("Quit2",\mathrm{Shutdown}\left(\right)\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Example with three buttons that is only possible with halign=none and HorizontalGlue.

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left(\mathrm{BoxColumn}\left(\mathrm{BoxRow}\left(\mathrm{Label}\left("This is a very long label to force additional space"‖"so the alignment of the buttons below are relevant"\right)\right),\mathrm{BoxRow}\left(\mathrm{halign}=\mathrm{none},\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right),\mathrm{Button}\left("Quit2",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right),\mathrm{Button}\left("Quit3",\mathrm{Shutdown}\left(\right)\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Example where enlarging the window will cause the buttons to remain on the left.

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left(\mathrm{BoxRow}\left(\mathrm{halign}=\mathrm{none},\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right),\mathrm{Button}\left("Quit2",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

Example where enlarging the window will cause the buttons to remain on opposite ends of the window.

 > \mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{BoxLayout}\left(\mathrm{BoxRow}\left(\mathrm{halign}=\mathrm{none},\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right),\mathrm{HorizontalGlue}\left(\right),\mathrm{Button}\left("Quit1",\mathrm{Shutdown}\left(\right)\right)\right)\right)\right):
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$