I am trying to use a wxGridBagSizer in wxCrafter (version 2.5, Ubuntu and Windows 10) to layout something like the following:
If I add a wxGridBagSizer to any window in wxCrafter it seems to overwrite the entire contents of the window. Also the "Show Preview" function does not seem to work.
However, the code that is generated by wxCrafter is correct, and indeed compiles to produce the desired output as above:
Code: Select all
m_pMainSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(m_pMainSizer);
m_pMainPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxTAB_TRAVERSAL);
m_pMainSizer->Add(m_pMainPanel, 1, wxEXPAND, 5);
m_pGridBagSizer = new wxGridBagSizer(0, 0);
m_pMainPanel->SetSizer(m_pGridBagSizer);
m_pStatic = new wxStaticText(m_pMainPanel, wxID_ANY, _("Static Text Label:"), wxDefaultPosition, wxSize(-1,-1), 0);
m_pGridBagSizer->Add(m_pStatic, wxGBPosition(0,0), wxGBSpan(1,1), wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5);
m_pButton = new wxButton(m_pMainPanel, wxID_ANY, _("My Button"), wxDefaultPosition, wxSize(-1,-1), 0);
m_pGridBagSizer->Add(m_pButton, wxGBPosition(0,1), wxGBSpan(1,1), wxALL, 5);
m_pText = new wxTextCtrl(m_pMainPanel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), wxTE_RICH2);
#if wxVERSION_NUMBER >= 3000
m_pText->SetHint(wxT(""));
#endif
m_pGridBagSizer->Add(m_pText, wxGBPosition(1,0), wxGBSpan(2,2), wxALL|wxEXPAND, 5);
m_pGridBagSizer->AddGrowableCol(0);