From 16a32d0cc4954d798ef35e1c8029bc642ced397c Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Tue, 14 Jan 2025 17:37:44 +0800 Subject: [PATCH] FIX: wxCUSTOMEVT_SET_TEMP_FINISH triggered twice while press enter jira: [none] Change-Id: I356fc4c6649dfe332fcb419bde0339d340d89242 (cherry picked from commit 541f91acec10eb7813c3a2c43411407252ca7d63) --- src/slic3r/GUI/Widgets/TempInput.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Widgets/TempInput.cpp b/src/slic3r/GUI/Widgets/TempInput.cpp index 747da0a10a..ddd0de1e43 100644 --- a/src/slic3r/GUI/Widgets/TempInput.cpp +++ b/src/slic3r/GUI/Widgets/TempInput.cpp @@ -93,6 +93,8 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString SetFinish(); }); text_ctrl->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent &e) { + /*the wxEVT_KILL_FOCUS will be triggered in Slic3r::GUI::wxGetApp().GetMainTopWindow()->SetFocus() for win or linux, but not APPLE*/ +#ifdef __APPLE__ OnEdit(); auto temp = text_ctrl->GetValue(); if (temp.ToStdString().empty()) return; @@ -103,10 +105,13 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString if (tempint > max_temp) { Warning(true, WARNING_TOO_HIGH); return; - } else { + } + else { Warning(false, WARNING_TOO_LOW); } SetFinish(); +#endif + Slic3r::GUI::wxGetApp().GetMainTopWindow()->SetFocus(); }); text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu