hiCreateGridLayout
hiCreateGridLayout(
s_name
[ ?items l_items ]
[ ?frame g_frame ]
[ ?margins l_margins ]
[ ?spacing g_spacing ]
[ ?horiz_align g_horizAlign ]
[ ?vert_align g_vertAlign ]
[ ?enabled g_enabled ]
[ ?invisible g_invisible ]
[ ?scrollable g_scrollable]
)
=> r_hiLayout
Description
Creates a grid layout by specifying the margins, spacing, and alignment.
Arguments
|
s_name
|
The symbol name of hiLayout.
|
|
?items l_items
|
The list of fields, hiLayouts, and spacer items contained within hiLayout.
Each entry in the items list can be a list containing the field or hiLayout followed by the required and optional field controls, or a list containing the spacer items.
The required field controls are:
-
'
row x_row: Specifies the row in which the field or layout is placed. The topmost row is 0. -
'
col x_column: Specifies the column in which the field or layout is placed. The leftmost column is 0.
The optional field controls are:
-
'
row_span x_row_span: The number of rows to span starting at x_row. A value of -1 indicates that the span extends to the bottom row. -
'
col_span x_column_span: The number of columns to span starting at x_column. A value of -1 indicates that the span extends to the rightmost column. -
'
horiz_align s_horiz_alignment: The s_horiz_alignment can be set to 'none, 'left, 'right, 'center, or 'justify (for text). -
'
vert_align x_vert_alignment: The s_vert_alignment can be set to 'none, 'top, 'bottom, or 'center.
The optional spacer items are:
-
'
col_min_width x_column x_width: Specifies the minimum width for a column. -
'
row_min_height x_row x_height: Specifies the minimum height for a row. -
'
col_stretch x_column x_stretch_factor: Specifies the horizontal stretch factor for a column. -
'
row_stretch x_row x_stretch_factor: Specifies the vertical stretch factor for a row.
|
|
?frame g_frame
|
Any of the following values:
-
nil: (Default) For an unframed layout. -
t: For an untitled frame. -
t_title: For a framed layout with a title.
|
|
?margins l_margins
|
Accepts integer values or nil for 'left, 'top, 'right, and 'bottom (in the same sequence) used to apply margins. If nil is specified, then the default margins are applied.
|
|
?spacing g_spacing
|
|
|
Specifies the integer value to apply for horizontal spacing. If nil is specified, then the default spacing is applied, which is inherited from its parent hiLayout or from the style.
|
|
?horiz_align g_horizAlign
|
|
|
Specifies the horizontal alignment and can be set to 'none, 'left, 'center, 'right, or 'justify. 'justify is used only for text.
Default value: none
|
|
?vert_align g_vertAlign
|
|
|
Specifies the vertical alignment and can be set to 'none, 'top, 'center, or 'bottom.
Default value: 'none
|
|
?enabled g_enabled
|
|
|
Specifies whether the fields in the layout are enabled. The default value is t.
|
|
?invisible g_invisible
|
|
|
Specifies whether the layout and the fields within are invisible. The default value is nil.
|
|
?scrollable g_scrollable
|
|
|
Adds a scroll bar in the layout if the content is large and cannot be accommodated. The default value is nil.
|
Value Returned
|
r_hiLayout
|
The defstruct for the horizontal box hiLayout and can be placed in an hiLayout form, scroll region, or tab page.
|
Examples
Creates a grid layout using the default margins, spacing, and alignment. It contains three text input fields for the first, middle, and last names with a frame title, Enter Full Name.
MyNameLayout = hiCreateGridLayout( 'MyNameLayout ?frame "Enter Full Name" ?items list (
list( hiCreateLabel( ?name 'MyFirstLabel ?labelText "First" ) 'row 0 'col 0 )
list( hiCreateStringField( ?name 'MyFirstName ) 'row 0 'col 1 )
list( hiCreateLabel( ?name 'MyMiddleLabel ?labelText "Middle" ) 'row 1 'col 0 )
list( hiCreateStringField( ?name 'MyMiddleName ) 'row 1 'col 1 )
list( hiCreateLabel( ?name 'MyLastLabel ?labelText "Last" ) 'row 2 'col 0 )
list( hiCreateStringField( ?name 'MyLastName ) 'row 2 'col 1 )
list( 'col_stretch 1 1 )
) )
Specifies the field options of the Grid Layout form.
procedure(ExGrid()
let((grid)
grid=hiCreateGridLayout(
'grid
?items
list(
list(
hiCreateLabel(
?name 'enableLabel
?labelText "Enable"
)
'row 0 'col 0
)
list(
hiCreateBooleanButton(
?name 'enable
?buttonText " "
)
'row 0 'col 1
)
list(
hiCreateLabel(
?name 'libLabel
?labelText "Lib"
)
'row 1 'col 0
)
list(
hiCreateStringField(
?name 'lib
)
'row 1 'col 1
)
list(
hiCreateLabel(
?name 'cellLabel
?labelText "Cell"
)
'row 2 'col 0
)
list(
hiCreateStringField(
?name 'cell
)
'row 2 'col 1
)
list(
hiCreateLabel(
?name 'viewLabel
?labelText "View"
)
'row 3 'col 0
)
list(
hiCreateStringField(
?name 'view
)
'row 3 'col 1
)
list(
hiCreateLabel(
?name 'explanation
?labelText "Fields can also span across multiple columns or rows"
)
'row 4 'col 0 'col_span 2
)
; only the entry fields are stretchable
; the labels do not stretch
list('col_stretch 0 0)
list('col_stretch 1 1)
)
?frame "Grid Layout"
)
hiCreateLayoutForm(
'ExGridLayout
"Grid"
; surround the grid with a vertical box layout
; to provide a stretch_item below to prevent fields
; spreading vertically when the form is stretched
hiCreateVerticalBoxLayout(
'vbox
?items
list(
grid
list('stretch_item 1)
)
)
)
hiDisplayForm(ExGridLayout)
)
)
Related Topics
hiLayout Form Functions
Return to top