What I've got so far is this:
It's hard to see but there is 1px wide red panel to the left of the green panel.
My main Frame (yellow) has a vertical BoxSizer, to which I add a text control, a horizontal BoxSizer containing two panels (red and green), and another text control:
Code: Select all
wxBoxSizer* hSizer = new wxBoxSizer(wxHORIZONTAL); wxPanel *panel1 = new wxPanel(this, wxID_ANY); panel1->SetBackgroundColour(*wxRED); wxPanel *panel2 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(128, 128)); panel2->SetBackgroundColour(*wxGREEN); hSizer->Add(panel1, 1, wxEXPAND); hSizer->Add(panel2, 0, wxEXPAND); wxBoxSizer* vSizer = new wxBoxSizer(wxVERTICAL); vSizer->Add(new wxTextCtrl(this, wxID_ANY)); vSizer->Add(hSizer, 1); vSizer->Add(new wxTextCtrl(this, wxID_ANY)); SetSizer(vSizer); SetBackgroundColour(*wxYELLOW);
I don't like asking such a specific question because I'd prefer to understand sizers as a whole rather than get an answer to my specific problem, but I feel like I'm stuck in a loop where I don't understand sizers well enough to ask the right question to help me understand sizers!
Is there some concept I'm missing here? Is wxPanel the wrong thing to use? Does hSizer need something doing to it to make its children fill its whole width?