parent
8ba48f8dc5
commit
82838cc640
2 changed files with 9 additions and 16 deletions
|
@ -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__
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue