Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2021-12-20 18:00:50 +0300
committerYuSanka <yusanka@gmail.com>2021-12-20 18:01:09 +0300
commit2419357a888f0ae9381a81d99245d70a57bfa1bb (patch)
treef6c93e985897ed98a2af92873e11048d55f60072 /src/slic3r/GUI
parent942c6ea7d89a0473b4f2b5529c516316b0b44b6b (diff)
Non-MSW specific: Fixed a default focus for message dialog
See https://twitter.com/ZMelmed/status/1472678454168539146
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r--src/slic3r/GUI/MsgDialog.cpp7
1 files changed, 6 insertions, 1 deletions
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;