How do I set a minimum window size in wxWidgets?

MaxVT picture MaxVT · Mar 4, 2009 · Viewed 8.9k times · Source

This is the hierarchy of widgets I've got:

Frame > wxBoxSizer > wxPanel > wxBoxSizer > wxFlexGridSizer (2 columns, 9 rows), with assorted form fields and buttons inside.

The first BoxSizer is to place the panel in, and the second is to make a border around the FlexGrid.

Everything looks nice, and the frame can expand properly if the window is enlarged, but it also can be resized to almost nothing, hiding all form elements.

How do I force the minimum size for the window to the one suggested by the FlexGridSizer by default (all form elements visible and having their minimal possible sizes)?

Answer

VZ. picture VZ. · Feb 12, 2010

Probably much too late but the answers given here are needlessly complicated, you just need to call SetSizerAndFit(sizer) to both associate the sizer with the frame, set its initial size and also set this size as minimal acceptable size.