5b. wxWidgets – Dynamic Positioning with Sizers

OVERVIEW

Dynamic positioning is done using Sizers. We look at 5 kinds of Sizers. Each of them is briefly described below

wxBoxSizer – This allows placement of controls stacked either vertically or horizontally.

wxStaticBoxSizer – This is the same as wxBoxSizer but adds a box around the sizer.

GridSizer – This lets us place controls in a grid consisting of rows and columns. The size of each cell will be the same.

FlexGridSizer – This adds more flexibility to GridSizer because each row and column can have different sizes.

GridBagSizer – This allows more complex layouts based on FlexGridSizer. In this each cell can span multiple rows or columns.

The process of using a Sizer is as follows:

  • Create a Panel or other container object
  • Create a Sizer
  • Create Controls within the parent container
  • Add controls to the Sizer
  • Add the Sizer to the container

Dynamic Positioning with Sizers

  • 5b-1. wxBoxSizer
  • 5b-2. wxStaticBoxSizer
  • 5b-3. GridSizer
  • 5b-4. FlexGridSizer
  • 5b-5. GridBagSizer
  • 5b-6. Building a Complex UI

Be the first to comment

Leave a Reply

Your email address will not be published.


*