Contents Up Previous Next

wxFlexGridSizer

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 wxGridSizer.

Since wxWidgets 2.5.0, wxFlexGridSizer 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 SetFlexibleDirection), it needs to be decided how the sizer should grow in the other ("non-flexible") direction in order to fill the available space. The SetNonFlexibleGrowMode method serves this purpose.

Derived from

wxGridSizer
wxSizer
wxObject

Include files

<wx/sizer.h>

See also

wxSizer, Sizer overview

Members

wxFlexGridSizer::wxFlexGridSizer
wxFlexGridSizer::AddGrowableCol
wxFlexGridSizer::AddGrowableRow
wxFlexGridSizer::GetFlexibleDirection
wxFlexGridSizer::GetNonFlexibleGrowMode
wxFlexGridSizer::RemoveGrowableCol
wxFlexGridSizer::RemoveGrowableRow
wxFlexGridSizer::SetFlexibleDirection
wxFlexGridSizer::SetNonFlexibleGrowMode


wxFlexGridSizer::wxFlexGridSizer

wxFlexGridSizer(int rows, int cols, int vgap, int hgap)

wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0)

Constructor for a wxGridSizer. 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.


wxFlexGridSizer::AddGrowableCol

void AddGrowableCol(size_t idx, int 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).


wxFlexGridSizer::AddGrowableRow

void AddGrowableRow(size_t idx, int proportion = 0)

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

See AddGrowableCol for the description of proportion parameter.


wxFlexGridSizer::GetFlexibleDirection

int GetFlexibleDirections() const

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

Return value

One of the following values:

wxVERTICAL Rows are flexibly sized.
wxHORIZONTAL Columns are flexibly sized.
wxBOTH Both rows and columns are flexibly sized (this is the default value).

See also

SetFlexibleDirection


wxFlexGridSizer::GetNonFlexibleGrowMode

int GetNonFlexibleGrowMode() const

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:

wxFLEX_GROWMODE_NONE Sizer doesn't grow in the non-flexible direction.
wxFLEX_GROWMODE_SPECIFIED Sizer honors growable columns/rows set with AddGrowableCol and AddGrowableRow. In this case equal sizing applies to minimum sizes of columns or rows (this is the default value).
wxFLEX_GROWMODE_ALL Sizer equally stretches all columns or rows in the non-flexible direction, whether they are growable or not in the flexible direction.

See also

SetFlexibleDirection, SetNonFlexibleGrowMode


wxFlexGridSizer::RemoveGrowableCol

void RemoveGrowableCol(size_t idx)

Specifies that column idx is no longer growable.


wxFlexGridSizer::RemoveGrowableRow

void RemoveGrowableRow(size_t idx)

Specifies that row idx is no longer growable.


wxFlexGridSizer::SetFlexibleDirection

void SetFlexibleDirection(int direction)

Specifies whether the sizer should flexibly resize its columns, rows, or both. Argument direction can be wxVERTICAL, wxHORIZONTAL or wxBOTH (which is the default value). Any other value is ignored. See GetFlexibleDirection() for the explanation of these values.

Note that this method does not trigger relayout.


wxFlexGridSizer::SetNonFlexibleGrowMode

void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode)

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

Note that this method does not trigger relayout.