diff options
author | YuSanka <yusanka@gmail.com> | 2018-06-11 17:23:10 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2018-06-11 17:23:10 +0300 |
commit | fba1bf7afcfb454fe51ca6ecdfd6e88f1ce98bdb (patch) | |
tree | e6edff744f632f03727aff7cfb6835d6356c52e3 /xs | |
parent | dc9a46b269476d62651dcc2af9de0537681e775b (diff) |
Fixed bug from issue #969
Diffstat (limited to 'xs')
-rw-r--r-- | xs/src/slic3r/GUI/Field.cpp | 20 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/Field.hpp | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index 64f3426c4..25925e3b6 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -199,7 +199,25 @@ namespace Slic3r { namespace GUI { }), temp->GetId()); #endif // __WXGTK__ - temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent) { on_change_field(); }), temp->GetId()); + temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent) + { +#ifdef __WXGTK__ + bool bChangedValueEvent = true; +#else + on_change_field(); +#endif //__WXGTK__ + }), temp->GetId()); + +#ifdef __WXGTK__ + temp->Bind(wxEVT_KEY_UP, [this](wxKeyEvent& event) + { + if (bChangedValueEvent) { + on_change_field(); + bChangedValueEvent = false; + } + event.Skip(); + }); +#endif //__WXGTK__ // select all text using Ctrl+A temp->Bind(wxEVT_CHAR, ([temp](wxKeyEvent& event) diff --git a/xs/src/slic3r/GUI/Field.hpp b/xs/src/slic3r/GUI/Field.hpp index 7e421244b..948178d3e 100644 --- a/xs/src/slic3r/GUI/Field.hpp +++ b/xs/src/slic3r/GUI/Field.hpp @@ -220,6 +220,9 @@ 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; +#endif //__WXGTK__ public: TextCtrl(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {} TextCtrl(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {} |