Final bug-fix for #1169 considering issue #971

This commit is contained in:
YuSanka 2018-09-05 15:03:20 +02:00
parent 8ba48f8dc5
commit 82838cc640
2 changed files with 9 additions and 16 deletions

View file

@ -228,19 +228,16 @@ namespace Slic3r { namespace GUI {
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
if (bChangedValueEvent) if (bChangedValueEvent)
change_field_value(evt);
else
bChangedValueEvent = true;
#else
on_change_field();
#endif //__WXGTK__ #endif //__WXGTK__
on_change_field();
}), temp->GetId()); }), temp->GetId());
#ifdef __WXGTK__ #ifdef __WXGTK__
// to correct value update on GTK we should call on_change_field() on // to correct value updating on GTK we should:
// wxEVT_KEY_UP or wxEVT_TEXT_PASTE instead of wxEVT_TEXT // 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_KEY_UP, &TextCtrl::change_field_value, this);
temp->Bind(wxEVT_TEXT_PASTE, &TextCtrl::change_field_value, this);
#endif //__WXGTK__ #endif //__WXGTK__
// select all text using Ctrl+A // select all text using Ctrl+A
@ -269,12 +266,8 @@ namespace Slic3r { namespace GUI {
#ifdef __WXGTK__ #ifdef __WXGTK__
void TextCtrl::change_field_value(wxEvent& event) void TextCtrl::change_field_value(wxEvent& event)
{ {
if (event.GetEventType() == wxEVT_TEXT_PASTE) if (bChangedValueEvent = event.GetEventType()==wxEVT_KEY_UP)
bChangedValueEvent = true;
else if (bChangedValueEvent) {
on_change_field(); on_change_field();
bChangedValueEvent = false;
}
event.Skip(); event.Skip();
}; };
#endif //__WXGTK__ #endif //__WXGTK__

View file

@ -222,7 +222,7 @@ inline bool is_sizer_field(const t_field& obj) { return !is_bad_field(obj) && ob
class TextCtrl : public Field { class TextCtrl : public Field {
using Field::Field; using Field::Field;
#ifdef __WXGTK__ #ifdef __WXGTK__
bool bChangedValueEvent = false; bool bChangedValueEvent = true;
void change_field_value(wxEvent& event); void change_field_value(wxEvent& event);
#endif //__WXGTK__ #endif //__WXGTK__
public: public: