From 5e4840fd349591e634044978685bc67108b708c6 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sun, 13 Jun 2021 14:47:40 +0200 Subject: [PATCH] feat(modulo): improve dwizard default button handling --- espanso-modulo/src/sys/wizard/wizard.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/espanso-modulo/src/sys/wizard/wizard.cpp b/espanso-modulo/src/sys/wizard/wizard.cpp index 22b4be0..5b298a1 100644 --- a/espanso-modulo/src/sys/wizard/wizard.cpp +++ b/espanso-modulo/src/sys/wizard/wizard.cpp @@ -89,6 +89,7 @@ protected: void welcome_start_clicked(wxCommandEvent &event); void navigate_to_next_page_or_close(); + void change_default_button(int target_page); public: DerivedFrame(wxWindow *parent); }; @@ -104,6 +105,7 @@ DerivedFrame::DerivedFrame(wxWindow *parent) int page = find_next_page(-1); if (page >= 0) { this->m_simplebook->SetSelection(page); + this->change_default_button(page); } else { Close(true); } @@ -136,7 +138,11 @@ void DerivedFrame::check_timer_tick( wxTimerEvent& event ) { void DerivedFrame::on_page_changed( wxBookCtrlEvent& event ) { int current_page = this->m_simplebook->GetSelection(); - switch (current_page) { + this->change_default_button(current_page); +} + +void DerivedFrame::change_default_button(int target_page) { + switch (target_page) { case WELCOME_PAGE_INDEX: { this->welcome_start_button->SetDefault();