mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Fixed updating of the options values after the clearing of the TextCtrl
This commit is contained in:
parent
85219b8bc0
commit
c6b597b813
2 changed files with 20 additions and 6 deletions
|
@ -161,6 +161,13 @@ void Field::get_value_by_opt_type(wxString& str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextCtrl::is_defined_input_value()
|
||||||
|
{
|
||||||
|
if (static_cast<wxTextCtrl*>(window)->GetValue().empty() && m_opt.type != coString && m_opt.type != coStrings)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void TextCtrl::BUILD() {
|
void TextCtrl::BUILD() {
|
||||||
auto size = wxSize(wxDefaultSize);
|
auto size = wxSize(wxDefaultSize);
|
||||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
||||||
|
@ -226,16 +233,21 @@ void TextCtrl::BUILD() {
|
||||||
temp->GetToolTip()->Enable(flag);
|
temp->GetToolTip()->Enable(flag);
|
||||||
}), temp->GetId());
|
}), temp->GetId());
|
||||||
|
|
||||||
#if !defined(__WXGTK__)
|
|
||||||
temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent& e)
|
temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent& e)
|
||||||
{
|
{
|
||||||
e.Skip();// on_kill_focus(e);
|
#if !defined(__WXGTK__)
|
||||||
|
e.Skip();
|
||||||
temp->GetToolTip()->Enable(true);
|
temp->GetToolTip()->Enable(true);
|
||||||
}), temp->GetId());
|
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
if (!is_defined_input_value())
|
||||||
|
on_kill_focus(e);
|
||||||
|
}), temp->GetId());
|
||||||
|
|
||||||
if (m_process_enter) {
|
if (m_process_enter) {
|
||||||
temp->Bind(wxEVT_TEXT_ENTER, ([this](wxCommandEvent& evt) { on_change_field(); }), temp->GetId());
|
temp->Bind(wxEVT_TEXT_ENTER, ([this](wxCommandEvent& evt) {
|
||||||
|
if(is_defined_input_value())
|
||||||
|
on_change_field();
|
||||||
|
}), temp->GetId());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent& evt)
|
temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent& evt)
|
||||||
|
@ -243,6 +255,7 @@ void TextCtrl::BUILD() {
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
if (bChangedValueEvent)
|
if (bChangedValueEvent)
|
||||||
#endif //__WXGTK__
|
#endif //__WXGTK__
|
||||||
|
if(is_defined_input_value())
|
||||||
on_change_field();
|
on_change_field();
|
||||||
}), temp->GetId());
|
}), temp->GetId());
|
||||||
|
|
||||||
|
@ -357,7 +370,7 @@ void SpinCtrl::BUILD() {
|
||||||
0, min_val, max_val, default_value);
|
0, min_val, max_val, default_value);
|
||||||
|
|
||||||
// temp->Bind(wxEVT_SPINCTRL, ([this](wxCommandEvent e) { tmp_value = undef_spin_val; on_change_field(); }), temp->GetId());
|
// temp->Bind(wxEVT_SPINCTRL, ([this](wxCommandEvent e) { tmp_value = undef_spin_val; on_change_field(); }), temp->GetId());
|
||||||
// temp->Bind(wxEVT_KILL_FOCUS, ([this](wxEvent& e) { tmp_value = undef_spin_val; on_kill_focus(e); }), temp->GetId());
|
temp->Bind(wxEVT_KILL_FOCUS, ([this](wxEvent& e) { on_kill_focus(e); }), temp->GetId());
|
||||||
temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent e)
|
temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent e)
|
||||||
{
|
{
|
||||||
// # On OSX / Cocoa, wxSpinCtrl::GetValue() doesn't return the new value
|
// # On OSX / Cocoa, wxSpinCtrl::GetValue() doesn't return the new value
|
||||||
|
|
|
@ -265,6 +265,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::any& get_value() override;
|
boost::any& get_value() override;
|
||||||
|
bool is_defined_input_value();
|
||||||
|
|
||||||
virtual void enable();
|
virtual void enable();
|
||||||
virtual void disable();
|
virtual void disable();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue