diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index f679de1fa..c7f1d48ff 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -227,20 +227,17 @@ namespace Slic3r { namespace GUI { temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent& evt) { #ifdef __WXGTK__ - if (bChangedValueEvent) - change_field_value(evt); - else - bChangedValueEvent = true; -#else - on_change_field(); + if (bChangedValueEvent) #endif //__WXGTK__ + on_change_field(); }), temp->GetId()); #ifdef __WXGTK__ - // to correct value update on GTK we should call on_change_field() on - // wxEVT_KEY_UP or wxEVT_TEXT_PASTE instead of wxEVT_TEXT + // to correct value updating on GTK we should: + // call on_change_field() on wxEVT_KEY_UP instead of wxEVT_TEXT + // and prevent value updating on wxEVT_KEY_DOWN + temp->Bind(wxEVT_KEY_DOWN, &TextCtrl::change_field_value, this); temp->Bind(wxEVT_KEY_UP, &TextCtrl::change_field_value, this); - temp->Bind(wxEVT_TEXT_PASTE, &TextCtrl::change_field_value, this); #endif //__WXGTK__ // select all text using Ctrl+A @@ -269,12 +266,8 @@ namespace Slic3r { namespace GUI { #ifdef __WXGTK__ void TextCtrl::change_field_value(wxEvent& event) { - if (event.GetEventType() == wxEVT_TEXT_PASTE) - bChangedValueEvent = true; - else if (bChangedValueEvent) { - on_change_field(); - bChangedValueEvent = false; - } + if (bChangedValueEvent = event.GetEventType()==wxEVT_KEY_UP) + on_change_field(); event.Skip(); }; #endif //__WXGTK__ diff --git a/xs/src/slic3r/GUI/Field.hpp b/xs/src/slic3r/GUI/Field.hpp index 67c7692fc..923f0fd7e 100644 --- a/xs/src/slic3r/GUI/Field.hpp +++ b/xs/src/slic3r/GUI/Field.hpp @@ -222,7 +222,7 @@ inline bool is_sizer_field(const t_field& obj) { return !is_bad_field(obj) && ob class TextCtrl : public Field { using Field::Field; #ifdef __WXGTK__ - bool bChangedValueEvent = false; + bool bChangedValueEvent = true; void change_field_value(wxEvent& event); #endif //__WXGTK__ public: