I have a top level frame, with a notebook, that holds a series of panels. I am trying to create three sets of controls for this panel, with each set of controls inside a static box. However, every attempt gives me all the controls on top of one another in the upper left of the panel. I'm working with another developer, and he's using wxPoint to position his controls, but none of the examples or samples I'm seeing use explicit pixel positioning, and I suspect he'll have problems when the application is run on different OSes, or someone has a different sized system font than him...
I've modeled my logic after examples in "Cross Platform GUI Programming with wxWidgets" and the "dialogs" sample that comes with wxWidgets, specifically the SettingsDialog. The SettingsDialog has staticBoxes used to enclose groups of parameters, and that is what I want. About the only difference between the dialog sample and my logic is that I'm on a wxPanel, and the sample uses a wxDialog. Should that matter?
Trying to get this figured out, I reduced to a single set of controls (from three different sets) and have only a few of the controls for this first set:
Code: Select all
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); // the outer container wxBoxSizer *boxSizer0 = new wxBoxSizer(wxVERTICAL); topSizer->Add(boxSizer0, 1, wxGROW | wxALL, 10); // a static box to enclose all parameters: wxStaticBox* enrollStaticBox = new wxStaticBox(this, ID_INTERFACES_ENROLL_ENCLOSINGBOX, wxT("Auto-enrollment on directory addition:")); // a static box sizer to help with the layout wxStaticBoxSizer* enrollStaticBoxSizer = new wxStaticBoxSizer(enrollStaticBox, wxVERTICAL); boxSizer0->Add(enrollStaticBoxSizer, 0, wxGROW | wxALL, 5); wxString enrollExplainer = wxT("Explaining the auto-enrolling logic here"); wxStaticText* enrollExplainerSt = new wxStaticText(this, ID_INTERFACES_ENROLL_EXPLAINER, enrollExplainer); // enrollStaticBoxSizer->Add(enrollExplainerSt, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); wxCheckBox* cbEnabled = new wxCheckBox(this, ID_INTERFACES_ENROLL_ENABLEDCHECKBOX, wxT("Yes, auto-enroll as images are added to this directory")); cbEnabled->SetValue(m_enrollParams.m_enabled); // enrollStaticBoxSizer->Add(cbEnabled, 0, wxGROW | wxALL, 5); wxTextCtrl* tcEnroll_directory = new wxTextCtrl(this, ID_INTERFACES_ENROLL_DIRECTORYST, m_enrollParams.m_directory.c_str()); // enrollStaticBoxSizer->Add(tcEnroll_directory, 0, wxGROW | wxALIGN_LEFT | wxALL, 5); SetSizerAndFit(topSizer);