## 27.6 Layout Management (cont.)

- You must include commands to turn on auto layout and tell the frame which sizer to use.

  >     SetAutoLayout(true);
  >     SetSizer(frame_sizer);

- The additional parameters in the `Add` function explain how the layout is maintained when the user resizes.

  >     wxBoxSizer* frame_sizer = new wxBoxSizer(wxVERTICAL);
  >     frame_sizer->Add(text, 1, wxGROW);
  >     frame_sizer->Add(button_sizer, 0, wxALIGN_CENTER);

- The second parameter indicates the ratio of size used in vertical components.
  - 0 means don't resize.
  - If you had a component with parameter 1, and another with parameter 2, the second would always use twice as much (vertical) space as the first.
- The third parameter describes horizontal growth behavior.
  - The text control grows with the window.
  - The button bar doesn't grow, but should be centered.

prev |top |next