From 2419357a888f0ae9381a81d99245d70a57bfa1bb Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 20 Dec 2021 16:00:50 +0100 Subject: Non-MSW specific: Fixed a default focus for message dialog See https://twitter.com/ZMelmed/status/1472678454168539146 --- src/slic3r/GUI/MsgDialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index a70a9b172..80a8159c0 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -75,8 +75,13 @@ void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool se wxButton* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, const wxString& label/* = wxString()*/) { wxButton* btn = new wxButton(this, btn_id, label); - if (set_focus) + if (set_focus) { btn->SetFocus(); + // For non-MSW platforms SetFocus is not enought to use it as default, when the dialog is closed by ENTER + // We have to set this button as the (permanently) default one in its dialog + // See https://twitter.com/ZMelmed/status/1472678454168539146 + btn->SetDefault(); + } btn_sizer->Add(btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, HORIZ_SPACING); btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { this->EndModal(btn_id); }); return btn; -- cgit v1.2.3