If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
By default, these "gauge" and "StaticText" are hidden and at runtime, I show up which one of them.
The problem is when the "StaticText" for example is shown to show a message it doesn't appear correctly at runtime as it was in design mode.
// The folliwng two lines placed in the constructor of the main window (wxFrame)
this->progressiveSizer->Show(false);
this->messageSizer->Show(false);
// The "messageSizer" will be shown when I click on a boutton
void MainFrm::saveEngineSettings_btn_Click(wxCommandEvent & event) {
if (getSelectedItemParent(this->engineSettings_tree) != this->engineSettings_tree->GetRootItem()) {
if(this->Config->Write(this->engineSettings_tree->GetItemText(getSelectedItemParent(this->engineSettings_tree)) + "/" + this->engineSettings_tree->GetItemText(this->engineSettings_tree->GetFocusedItem()), this->engineSettingValue_txt->GetValue())){
this->Config->Flush(true);
this->messageSizer->Show(true);
this->message_label->SetLabel("Data saved successfully");
}
}
}
How to make it not overlapping with other elements as it was in design mode?
BTW: Unless you intend to add more items to them, progressiveSizer and messageSizer are not needed. Any sizer that contains only one element, doesn't make sense in 99% of cases.
// The following placed in the constructor of the main window (wxFrame)
this->infoSizer->Show(false);
// -----------------------------------------
// The "infoSizer" will be shown when I click on a boutton
void MainFrm::saveEngineSettings_btn_Click(wxCommandEvent & event) {
if (getSelectedItemParent(this->engineSettings_tree) != this->engineSettings_tree->GetRootItem()) {
if(this->Config->Write(this->engineSettings_tree->GetItemText(getSelectedItemParent(this->engineSettings_tree)) + "/" + this->engineSettings_tree->GetItemText(this->engineSettings_tree->GetFocusedItem()), this->engineSettingValue_txt->GetValue())){
this->Config->Flush(true);
this->infoSizer->Show(true);
this->message_label->SetLabel("Data saved successfully");
this->infoSizer->Layout();
}
}
}
Alternatively, try calling Layout() on the highest sizer in the hierarchy.
Now it works well as intended after using "layout()" method on the highest sizer (Main sizer that contains all elements in the wxFrame).
Thank you for helping me.