However, I am currently getting some usual errors with my sizers. Previously, I did not get these errors in 3.0.1. Looking through the documentation of sizers, I can't seem to figure out what is wrong.
I am adding sizers to my form and I am getting an error called:
"../src/common/wincmn.cpp(2471): assert ""!m_containingSizer"" failed in SetContainingSizer(): Adding a window already in a sizer, detach it first!"
This occurs at a line that I will be indicating on the code below. I have been looking through the examples and documentation and I can't seem to figure out why this error exists. I don't notice anything too different that I am doing. The only thing different from my perspective is that I am initilizing the widgets global to the class and then calling the Create function and then passing it into the add function of the sizer.
Code: Select all
wxFont *font = new wxFont(8.5, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *intermediateSizer = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *footerSizer1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *footerSizer2 = new wxBoxSizer(wxHORIZONTAL);
_outputConsole->Create(this, wxID_ANY, wxEmptyString, wxPoint(12, 12), wxSize(373, 98), wxTE_MULTILINE);
_outputConsole->SetFont(*font);
_outputConsole->Enable(false);
_inputConsole->Create(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(373, 98), wxTE_MULTILINE);
_inputConsole->SetFont(*font);
_inputConsole->RemoveChild(this);
wxButton *clearInputButton = new wxButton(this, generalFrameButton::ID_BUTTON1, "Clear Input", wxPoint(12, 242), wxSize(75, 23));
clearInputButton->SetFont(*font);
wxButton *clearOutputButton = new wxButton(this, generalFrameButton::ID_BUTTON2, "Clear Output", wxPoint(93, 242), wxSize(75, 25));
clearOutputButton->SetFont(*font);
wxButton *evaluateButton = new wxButton(this, wxID_OK, "Evaluate", wxPoint(310, 242), wxSize(75, 23));
evaluateButton->SetFont(*font);
footerSizer2->Add(evaluateButton, 0, wxCENTER | wxALL, 6);
footerSizer1->Add(clearInputButton, 0, wxCENTER | wxALL, 6);
footerSizer1->Add(clearOutputButton, 0, wxCENTER | wxTOP | wxBOTTOM | wxRIGHT, 6);
intermediateSizer->Add(footerSizer1, 0, wxALIGN_LEFT);
intermediateSizer->Add(137, 0, 0);
intermediateSizer->Add(evaluateButton, 0, wxCENTER);
// topSizer->Add(_outputConsole, wxSizerFlags(0).Border(wxALL, 6));
topSizer->Add(_inputConsole, 0, wxLEFT | wxRIGHT | wxBOTTOM, 6); // The error is here!
topSizer->Add(0, 20, 0);
topSizer->Add(intermediateSizer);
SetSizerAndFit(topSizer);
Code: Select all
topSizer->Add(_outputConsole, 0, wxCENTER| wxALL, 6);