diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index bcbc381eff..1fcaef1b52 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1334,27 +1334,7 @@ void SpinCtrl::BUILD() { if (!parsed || value < INT_MIN || value > INT_MAX) tmp_value = UNDEF_VALUE; else { - tmp_value = std::min(std::max((int)value, temp->GetMin()), temp->GetMax()); -#ifdef __WXOSX__ -#ifdef UNDEFINED__WXOSX__ // BBS - // Forcibly set the input value for SpinControl, since the value - // inserted from the keyboard or clipboard is not updated under OSX - SpinInput* spin = static_cast(window); - spin->SetValue(tmp_value); - // But in SetValue() is executed m_text_ctrl->SelectAll(), so - // discard this selection and set insertion point to the end of string - // temp->GetText()->SetInsertionPointEnd(); -#endif -#else - // update value for the control only if it was changed in respect to the Min/max values - if (tmp_value != (int)value) { - temp->SetValue(tmp_value); - // But after SetValue() cursor ison the first position - // so put it to the end of string - // int pos = std::to_string(tmp_value).length(); - // temp->SetSelection(pos, pos); - } -#endif + tmp_value = (int)value; } }), temp->GetTextCtrl()->GetId()); @@ -1375,6 +1355,10 @@ void SpinCtrl::propagate_value() on_kill_focus(); } else { auto ctrl = dynamic_cast(window); + tmp_value = std::min(std::max(tmp_value, ctrl->GetMin()), ctrl->GetMax()); + if (ctrl->GetValue() != tmp_value) + ctrl->SetValue(tmp_value); // Clamp now when the user is done typing (kill focus / Enter / spin arrows) + if (m_value.empty() ? !ctrl->GetTextCtrl()->GetLabel().IsEmpty() : ctrl->GetValue() != boost::any_cast(m_value))