Fixed SPE-1000.
Since the value inserted from the keyboard or clipboard is not updated under OSX, we forcibly set the input value for SpinControl every time during editing. Thus we can't set min control value bigger then 0. Otherwise, it couldn't be possible to input from keyboard value less then min_val.
This commit is contained in:
parent
eddf932161
commit
283cee3f27
2 changed files with 20 additions and 3 deletions
|
@ -2306,13 +2306,13 @@ void PrintConfigDef::init_sla_params()
|
|||
def->full_label = L("Number of pixels in");
|
||||
def->label = ("X");
|
||||
def->tooltip = L("Number of pixels in X");
|
||||
def->min = 1;
|
||||
def->min = 100;
|
||||
def->set_default_value(new ConfigOptionInt(2560));
|
||||
|
||||
def = this->add("display_pixels_y", coInt);
|
||||
def->label = ("Y");
|
||||
def->tooltip = L("Number of pixels in Y");
|
||||
def->min = 1;
|
||||
def->min = 100;
|
||||
def->set_default_value(new ConfigOptionInt(1440));
|
||||
|
||||
def = this->add("display_mirror_x", coBool);
|
||||
|
|
|
@ -559,7 +559,16 @@ void SpinCtrl::BUILD() {
|
|||
break;
|
||||
}
|
||||
|
||||
const int min_val = m_opt.min == INT_MIN ? 0: m_opt.min;
|
||||
const int min_val = m_opt.min == INT_MIN
|
||||
#ifdef __WXOSX__
|
||||
// We will forcibly set the input value for SpinControl, since the value
|
||||
// inserted from the keyboard is not updated under OSX.
|
||||
// So, we can't set min control value bigger then 0.
|
||||
// Otherwise, it couldn't be possible to input from keyboard value
|
||||
// less then min_val.
|
||||
|| m_opt.min > 0
|
||||
#endif
|
||||
? 0 : m_opt.min;
|
||||
const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647;
|
||||
|
||||
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||
|
@ -631,6 +640,14 @@ void SpinCtrl::propagate_value()
|
|||
if (tmp_value == UNDEF_VALUE) {
|
||||
on_kill_focus();
|
||||
} else {
|
||||
#ifdef __WXOSX__
|
||||
// check input value for minimum
|
||||
if (m_opt.min > 0 && tmp_value < m_opt.min) {
|
||||
wxSpinCtrl* spin = static_cast<wxSpinCtrl*>(window);
|
||||
spin->SetValue(m_opt.min);
|
||||
spin->GetText()->SetInsertionPointEnd();
|
||||
}
|
||||
#endif
|
||||
on_change_field();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue