as I can not find a solution for this by myself, I dare to ask what I am doing wrong here...
The first image shows, what I get with my code and the second image shows how it should look like (or what I expected to get)... Problem is whatever the last element in my wxBoxSizers is, it is vertikaly cropped by the height of approximatly one Butten-Height.?!
Could anyone please give me a hint, what stupid things I am doing there (I think the Problem sits in front of the screen, because this is my first attempt in setting up a GUI with wx...)
many thanks!
Stefan
Code: Select all
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size) , m_timer(this, TIMER_ID)
{
// Top-level-sizer in frame
wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL );
// first sizer
wxBoxSizer* mySizer0 = new wxBoxSizer( wxVERTICAL );
// second sizer
wxBoxSizer* mySizer1 = new wxBoxSizer( wxHORIZONTAL );
// third sizer
wxBoxSizer* mySizer2 = new wxBoxSizer( wxVERTICAL );
// create some buttons/radiobuttons in sizer 2
mySizer2->Add(
new wxButton(this, wxID_OK, wxT("Button1")),
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
mySizer2->Add(
new wxButton(this, wxID_OK, wxT("Button2")),
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
mySizer2->Add(
new wxButton(this, wxID_OK, wxT("Button3")),
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
// Add Sizer 2 to Sizer 1
mySizer1->Add(
mySizer2,
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
// Add a Spacer to Sizer 1
mySizer1->AddSpacer( 256 );
// Add Sizer 1 to Sizer 0
mySizer0->Add(
mySizer1,
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
// Create text-control inside sizer0
// wxFont* myFont = new wxFont(10,wxFONTFAMILY_TELETYPE,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false);
mySizer0->Add(
new wxTextCtrl(this, wxID_ANY, wxT("\n"),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY),
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
// Add Sizer 0 to toplevelSizer...
topSizer->Add(
mySizer0,
0, // make vertically stretchable
wxEXPAND| // make horizontally stretchable
wxALL, // and make border all around
4 ); // set border width to 10
// use sizer for layout
topSizer->Fit( this ); // fit the dialog to the contents
topSizer->SetSizeHints( this ); // set hints to honor min size
topSizer->Layout();
SetSizer( topSizer );
std::cerr << "topSizer->GetChildren().size()=" << topSizer->GetChildren().size();