From 8b1ec73b71c56118eb53f48bb98cb0d5d43f4c1c Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Wed, 10 Aug 2022 16:36:47 +0800 Subject: [PATCH] FIX: TempInput use attach_child of StateHandler Change-Id: Id49052e484389e8f88eb021cc25d2127f56369f7 --- src/slic3r/GUI/Widgets/TempInput.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/Widgets/TempInput.cpp b/src/slic3r/GUI/Widgets/TempInput.cpp index 496249d92b..fbe8828c0e 100644 --- a/src/slic3r/GUI/Widgets/TempInput.cpp +++ b/src/slic3r/GUI/Widgets/TempInput.cpp @@ -48,25 +48,21 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString text_ctrl = new wxTextCtrl(this, wxID_ANY, text, {5, 5}, wxDefaultSize, wxTE_PROCESS_ENTER | wxBORDER_NONE, wxTextValidator(wxFILTER_NUMERIC), wxTextCtrlNameStr); text_ctrl->SetMaxLength(3); state_handler.attach_child(text_ctrl); - text_ctrl->Bind(wxEVT_SET_FOCUS, [this](auto &e) { + e.Skip(); if (m_read_only) return; - e.SetId(GetId()); - ProcessEventLocally(e); - - //enter input mode + // enter input mode auto temp = text_ctrl->GetValue(); if (temp.length() > 0 && temp[0] == (0x5f)) { text_ctrl->SetValue(wxEmptyString); } - if (wdialog != nullptr) { wdialog->Dismiss(); } }); + text_ctrl->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { + if (m_read_only) { SetCursor(wxCURSOR_ARROW); } + }); text_ctrl->Bind(wxEVT_KILL_FOCUS, [this](auto &e) { OnEdit(); - e.SetId(GetId()); - ProcessEventLocally(e); - auto temp = text_ctrl->GetValue(); if (temp.ToStdString().empty()) { text_ctrl->SetValue(wxString("_")); @@ -90,9 +86,6 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString }); text_ctrl->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent &e) { OnEdit(); - e.SetId(GetId()); - ProcessEventLocally(e); - auto temp = text_ctrl->GetValue(); if (temp.ToStdString().empty()) return; if (!AllisNum(temp.ToStdString())) return;