wxRuby Documentation Home

# Wx::FlexGridSizer

A flex grid sizer is a sizer which lays out its children in a two-dimensional
table with all table fields in one row having the same
height and all fields in one column having the same width, but all
rows or all columns are not necessarily the same height or width as in
the GridSizer.

Since Widgets 2.5.0, FlexGridSizer can also size items equally in one
direction but unequally (“flexibly”) in the other. If the sizer is only
flexible in one direction (this can be changed using
set_flexible_drection),
it needs to be decided how the sizer should grow in the other (“non flexible”)
direction in order to fill the available space. The
set_non_flexible_grow_mode method
serves this purpose.

## Derived from

GridSizer

Sizer

Object

## See also

Sizer

## Methods

- FlexGridSizer.new
- FlexGridSizer#add_growable_col
- FlexGridSizer#add_growable_row
- FlexGridSizer#get_flexible_direction
- FlexGridSizer#get_non_flexible_grow_mode
- FlexGridSizer#remove_growable_col
- FlexGridSizer#remove_growable_row
- FlexGridSizer#set_flexible_direction
- FlexGridSizer#set_non_flexible_grow_mode

### FlexGridSizer.new

FlexGridSizer.new(%(arg-type)Integer% rows, Integer cols, Integer vgap, Integer hgap) FlexGridSizer.new(%(arg-type)Integer% cols, Integer vgap = 0, Integer hgap = 0)

Constructor for a GridSizer. rows and cols determine the number of
columns and rows in the sizer – if either of the parameters is zero, it will be
calculated to form the total number of children in the sizer, thus making the
sizer grow dynamically. vgap and hgap define extra space between
all children.

### FlexGridSizer#add_growable_col

add_growable_col(%(arg-type)Integer% idx, Integer proportion = $0$)

Specifies that column idx (starting from zero) should be grown if
there is extra space available to the sizer.

The proportion parameter has the same meaning as the stretch factor for
the sizers except that if all proportions are $0$,
then all columns are resized equally (instead of not being resized at all).

### FlexGridSizer#add_growable_row

add_growable_row(%(arg-type)Integer% idx, Integer proportion = $0$)

Specifies that row idx (starting from zero) should be grown if there
is extra space available to the sizer.

See add_growable_col for the description
of proportion parameter.

### FlexGridSizer#get_flexible_direction

Integer get_flexible_directions()

Returns a Orientation value that specifies whether the sizer flexibly
resizes its columns, rows, or both (default).

#### Return value

One of the following values:

VERTICAL | Rows are flexibly sized.
HORIZONTAL | Columns are flexibly sized.
BOTH | Both rows and columns are flexibly sized (this is the default value).

#### See also

set_flexible_drection

### FlexGridSizer#get_non_flexible_grow_mode

Integer get_non_flexible_grow_mode()

Returns the value that specifies how the sizer grows in the “non flexible”
direction if there is one.

#### Return value

One of the following values:

FLEX_GROWMODE_NONE | Sizer doesn’t grow in the non flexible direction.
FLEX_GROWMODE_SPECIFIED | Sizer honors growable columns/rows set with"add_growable_col":#FlexGridSizer_addgrowablecol and add_growable_row this case equal sizing applies to minimum sizes of columns orrows (this is the default value).
FLEX_GROWMODE_ALL | Sizer equally stretches all columns or rowsin the non flexible direction, whether they are growable or not in the flexibledirection.

#### See also

set_flexible_drection,
set_non_flexible_grow_mode

### FlexGridSizer#remove_growable_col

remove_growable_col(%(arg-type)Integer% idx)

Specifies that column idx is no longer growable.

### FlexGridSizer#remove_growable_row

remove_growable_row(%(arg-type)Integer% idx)

Specifies that row idx is no longer growable.

### FlexGridSizer#set_flexible_direction

set_flexible_directions(%(arg-type)Integer% direction)

Specifies whether the sizer should flexibly resize its columns, rows, or
both. Argument `direction` can be `VERTICAL`, `HORIZONTAL`
or `BOTH` (which is the default value). Any other value is ignored. See
get_flexible_direction for the
explanation of these values.

Note that this method does not trigger relayout.

### FlexGridSizer#set_non_flexible_grow_mode

set_non_flexible_grow_mode(%(arg-type)FlexSizerGrowMode% mode)

Specifies how the sizer should grow in the non flexible direction if
there is one (so
set_flexible_directions must have
been called previously). Argument mode can be one of those documented in
get_non_flexible_grow_mode, please
see there for their explanation.

Note that this method does not trigger relayout.

[This page automatically generated from the Textile source at 2023-06-09 00:45:33 +0000]