Fixed bug from issue #1169
This commit is contained in:
parent
22569de00f
commit
f67060f012
@ -234,14 +234,10 @@ namespace Slic3r { namespace GUI {
|
||||
}), temp->GetId());
|
||||
|
||||
#ifdef __WXGTK__
|
||||
temp->Bind(wxEVT_KEY_UP, [this](wxKeyEvent& event)
|
||||
{
|
||||
if (bChangedValueEvent) {
|
||||
on_change_field();
|
||||
bChangedValueEvent = false;
|
||||
}
|
||||
event.Skip();
|
||||
});
|
||||
// to correct value update on GTK we should call on_change_field() on
|
||||
// wxEVT_KEY_UP or wxEVT_TEXT_PASTE instead of wxEVT_TEXT
|
||||
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
|
||||
@ -267,6 +263,17 @@ namespace Slic3r { namespace GUI {
|
||||
void TextCtrl::enable() { dynamic_cast<wxTextCtrl*>(window)->Enable(); dynamic_cast<wxTextCtrl*>(window)->SetEditable(true); }
|
||||
void TextCtrl::disable() { dynamic_cast<wxTextCtrl*>(window)->Disable(); dynamic_cast<wxTextCtrl*>(window)->SetEditable(false); }
|
||||
|
||||
#ifdef __WXGTK__
|
||||
void TextCtrl::change_field_value(wxEvent& event)
|
||||
{
|
||||
if (bChangedValueEvent) {
|
||||
on_change_field();
|
||||
bChangedValueEvent = false;
|
||||
}
|
||||
event.Skip();
|
||||
};
|
||||
#endif //__WXGTK__
|
||||
|
||||
void CheckBox::BUILD() {
|
||||
auto size = wxSize(wxDefaultSize);
|
||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
||||
|
@ -223,6 +223,7 @@ class TextCtrl : public Field {
|
||||
using Field::Field;
|
||||
#ifdef __WXGTK__
|
||||
bool bChangedValueEvent = false;
|
||||
void change_field_value(wxEvent& event);
|
||||
#endif //__WXGTK__
|
||||
public:
|
||||
TextCtrl(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
|
||||
|
Loading…
Reference in New Issue
Block a user