A bunch of tab fixes (#6551)

* Make sure the speed tab is properly hidden when toggle off advance mode

* Clear each page before clearing the parent, otherwise the child pages will be destroyed twice

* Fix crash if current selected tab is positioned after the removed tab

* Fix issue that sometimes the printer config first page is not displayed

* Fix issue that the wrong tab item get bold if the number of tabs changed
This commit is contained in:
Noisyfox 2024-08-26 20:21:59 +08:00 committed by GitHub
parent 2bf54878f7
commit 3757295b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 17 deletions

View file

@ -468,14 +468,7 @@ void Tab::create_preset_tab()
// so that the cursor jumps to the last item.
// BBS: bold selection
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGING, [this](wxCommandEvent& event) {
if (m_disable_tree_sel_changed_event)
return;
const auto sel_item = m_tabctrl->GetSelection();
//OutputDebugStringA("wxEVT_TAB_SEL_CHANGING ");
//OutputDebugStringA(m_title.c_str());
//const auto selection = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
//OutputDebugString(selection);
//OutputDebugStringA("\n");
m_tabctrl->SetItemBold(sel_item, false);
});
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGED, [this](wxCommandEvent& event) {
@ -5282,10 +5275,10 @@ bool Tab::update_current_page_in_background(int& item)
// clear pages from the controlls
// BBS: fix after new layout, clear page in backgroud
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
for (auto p : m_pages)
p->clear();
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
update_undo_buttons();