mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-21 20:18:17 +08:00
Replace SetValue with ChangeValue to avoid wxWidgets to fire useless events
This commit is contained in:
parent
aae9625a13
commit
e563c62094
@ -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…
x
Reference in New Issue
Block a user