mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
Replace SetValue with ChangeValue to avoid wxWidgets to fire useless events
This commit is contained in:
parent
aae9625a13
commit
e563c62094
1 changed files with 7 additions and 4 deletions
|
@ -167,12 +167,15 @@ sub _build_field {
|
||||||
? Wx::SpinCtrl->new($self->parent, -1, $opt->{default}, wxDefaultPosition, $size, $style, $opt->{min} || 0, $opt->{max} || 2147483647, $opt->{default})
|
? Wx::SpinCtrl->new($self->parent, -1, $opt->{default}, wxDefaultPosition, $size, $style, $opt->{min} || 0, $opt->{max} || 2147483647, $opt->{default})
|
||||||
: Wx::TextCtrl->new($self->parent, -1, $opt->{default}, wxDefaultPosition, $size, $style);
|
: Wx::TextCtrl->new($self->parent, -1, $opt->{default}, wxDefaultPosition, $size, $style);
|
||||||
$field->Disable if $opt->{readonly};
|
$field->Disable if $opt->{readonly};
|
||||||
$self->_setters->{$opt_key} = sub { $field->SetValue($_[0]) };
|
|
||||||
|
|
||||||
my $on_change = sub { $self->_on_change($opt_key, $field->GetValue) };
|
my $on_change = sub { $self->_on_change($opt_key, $field->GetValue) };
|
||||||
$opt->{type} eq 'i'
|
if ($opt->{type} eq 'i') {
|
||||||
? EVT_SPINCTRL ($self->parent, $field, $on_change)
|
$self->_setters->{$opt_key} = sub { $field->SetValue($_[0]) };
|
||||||
: EVT_TEXT ($self->parent, $field, $on_change);
|
EVT_SPINCTRL ($self->parent, $field, $on_change);
|
||||||
|
} else {
|
||||||
|
$self->_setters->{$opt_key} = sub { $field->ChangeValue($_[0]) };
|
||||||
|
EVT_TEXT ($self->parent, $field, $on_change);
|
||||||
|
}
|
||||||
$tooltip .= " (default: " . $opt->{default} . ")" if ($opt->{default});
|
$tooltip .= " (default: " . $opt->{default} . ")" if ($opt->{default});
|
||||||
} elsif ($opt->{type} eq 'bool') {
|
} elsif ($opt->{type} eq 'bool') {
|
||||||
$field = Wx::CheckBox->new($self->parent, -1, "");
|
$field = Wx::CheckBox->new($self->parent, -1, "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue