Public Member Functions

# wxGridSizer Class Reference
[Window Layout]

`#include <wx/sizer.h>`

Inheritance diagram for wxGridSizer:
[legend]

## Detailed Description

A grid sizer is a sizer which lays out its children in a two-dimensional table with all table fields having the same size, i.e.

the width of each field is the width of the widest child, the height of each field is the height of the tallest child.

##

Library: wxCore
Category: Window Layout

See also:
  wxSizer, Sizers Overview

## Public Member Functions
int | GetCols () const
| Returns the number of columns that has been specified for the sizer.
int | GetRows () const
| Returns the number of rows that has been specified for the sizer.
int | GetEffectiveColsCount () const
| Returns the number of columns currently used by the sizer.
int | GetEffectiveRowsCount () const
| Returns the number of rows currently used by the sizer.
int | GetHGap () const
| Returns the horizontal gap (in pixels) between cells in the sizer.
int | GetVGap () const
| Returns the vertical gap (in pixels) between the cells in the sizer.
void | SetCols (int cols)
| Sets the number of columns in the sizer.
void | SetHGap (int gap)
| Sets the horizontal gap (in pixels) between cells in the sizer.
void | SetRows (int rows)
| Sets the number of rows in the sizer.
void | SetVGap (int gap)
| Sets the vertical gap (in pixels) between the cells in the sizer.
| wxGridSizer (int cols, int vgap, int hgap)
| wxGridSizer constructors.
| wxGridSizer (int cols, const wxSize &gap=wxSize(0, 0))
| wxGridSizer constructors.
| wxGridSizer (int rows, int cols, int vgap, int hgap)
| wxGridSizer constructors.
| wxGridSizer (int rows, int cols, const wxSize &gap)
| wxGridSizer constructors.

List of all members.

## Constructor & Destructor Documentation

wxGridSizer::wxGridSizer | ( | int | cols,
|  | int | vgap,
|  | int | hgap |
| ) |  |  |

wxGridSizer constructors.

Usually only the number of columns in the flex grid sizer needs to be specified using cols argument. The number of rows will be deduced automatically depending on the number of the elements added to the sizer.

If a constructor form with rows parameter is used (and the value of rows argument is not zero, meaning "unspecified") the sizer will check that no more than `cols*rows` elements are added to it, i.e. that no more than the given number of rows is used. Adding less than maximally allowed number of items is not an error however.

Finally, it is also possible to specify the number of rows and use 0 for cols. In this case, the sizer will use the given fixed number of rows and as many columns as necessary.

The gap (or vgap and hgap, which correspond to the height and width of the wxSize object) argument defines the size of the padding between the rows (its vertical component, or vgap) and columns (its horizontal component, or hgap), in pixels.

Since:
  2.9.1 (except for the four argument overload)

wxGridSizer::wxGridSizer | ( | int | cols,
|  | const wxSize & | gap = `wxSize(0, 0)` |
| ) |  |  |

wxGridSizer constructors.

Usually only the number of columns in the flex grid sizer needs to be specified using cols argument. The number of rows will be deduced automatically depending on the number of the elements added to the sizer.

If a constructor form with rows parameter is used (and the value of rows argument is not zero, meaning "unspecified") the sizer will check that no more than `cols*rows` elements are added to it, i.e. that no more than the given number of rows is used. Adding less than maximally allowed number of items is not an error however.

Finally, it is also possible to specify the number of rows and use 0 for cols. In this case, the sizer will use the given fixed number of rows and as many columns as necessary.

The gap (or vgap and hgap, which correspond to the height and width of the wxSize object) argument defines the size of the padding between the rows (its vertical component, or vgap) and columns (its horizontal component, or hgap), in pixels.

Since:
  2.9.1 (except for the four argument overload)

wxGridSizer::wxGridSizer | ( | int | rows,
|  | int | cols,
|  | int | vgap,
|  | int | hgap |
| ) |  |  |

wxGridSizer constructors.

Usually only the number of columns in the flex grid sizer needs to be specified using cols argument. The number of rows will be deduced automatically depending on the number of the elements added to the sizer.

If a constructor form with rows parameter is used (and the value of rows argument is not zero, meaning "unspecified") the sizer will check that no more than `cols*rows` elements are added to it, i.e. that no more than the given number of rows is used. Adding less than maximally allowed number of items is not an error however.

Finally, it is also possible to specify the number of rows and use 0 for cols. In this case, the sizer will use the given fixed number of rows and as many columns as necessary.

The gap (or vgap and hgap, which correspond to the height and width of the wxSize object) argument defines the size of the padding between the rows (its vertical component, or vgap) and columns (its horizontal component, or hgap), in pixels.

Since:
  2.9.1 (except for the four argument overload)

wxGridSizer::wxGridSizer | ( | int | rows,
|  | int | cols,
|  | const wxSize & | gap |
| ) |  |  |

wxGridSizer constructors.

Usually only the number of columns in the flex grid sizer needs to be specified using cols argument. The number of rows will be deduced automatically depending on the number of the elements added to the sizer.

If a constructor form with rows parameter is used (and the value of rows argument is not zero, meaning "unspecified") the sizer will check that no more than `cols*rows` elements are added to it, i.e. that no more than the given number of rows is used. Adding less than maximally allowed number of items is not an error however.

Finally, it is also possible to specify the number of rows and use 0 for cols. In this case, the sizer will use the given fixed number of rows and as many columns as necessary.

The gap (or vgap and hgap, which correspond to the height and width of the wxSize object) argument defines the size of the padding between the rows (its vertical component, or vgap) and columns (its horizontal component, or hgap), in pixels.

Since:
  2.9.1 (except for the four argument overload)

## Member Function Documentation

int wxGridSizer::GetCols | ( |  | ) | const

Returns the number of columns that has been specified for the sizer.

Returns zero if the sizer is automatically adjusting the number of columns depending on number of its children. To get the effective number of columns or rows being currently used, see GetEffectiveColsCount()

int wxGridSizer::GetEffectiveColsCount | ( |  | ) | const

Returns the number of columns currently used by the sizer.

This will depend on the number of children the sizer has if the sizer is automatically adjusting the number of columns/rows.

Since:
  2.9.1

int wxGridSizer::GetEffectiveRowsCount | ( |  | ) | const

Returns the number of rows currently used by the sizer.

This will depend on the number of children the sizer has if the sizer is automatically adjusting the number of columns/rows.

Since:
  2.9.1

int wxGridSizer::GetHGap | ( |  | ) | const

Returns the horizontal gap (in pixels) between cells in the sizer.

int wxGridSizer::GetRows | ( |  | ) | const

Returns the number of rows that has been specified for the sizer.

Returns zero if the sizer is automatically adjusting the number of rows depending on number of its children. To get the effective number of columns or rows being currently used, see GetEffectiveRowsCount().

int wxGridSizer::GetVGap | ( |  | ) | const

Returns the vertical gap (in pixels) between the cells in the sizer.

void wxGridSizer::SetCols | ( | int | cols | ) |

Sets the number of columns in the sizer.

void wxGridSizer::SetHGap | ( | int | gap | ) |

Sets the horizontal gap (in pixels) between cells in the sizer.

void wxGridSizer::SetRows | ( | int | rows | ) |

Sets the number of rows in the sizer.

void wxGridSizer::SetVGap | ( | int | gap | ) |

Sets the vertical gap (in pixels) between the cells in the sizer.

|  | [ top ]