Fixed bug from issue #969

This commit is contained in:
YuSanka 2018-06-11 16:23:10 +02:00
parent dc9a46b269
commit fba1bf7afc
2 changed files with 22 additions and 1 deletions

View file

@ -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)

View file

@ -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) {}