mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 09:55:57 +08:00
Associate correct events with the combobox->choice change.
This commit is contained in:
parent
67acbca341
commit
703adba7e3
@ -217,7 +217,7 @@ extends 'Slic3r::GUI::OptionsGroup::Field::wxWindow';
|
|||||||
|
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Wx qw(:misc :combobox);
|
use Wx qw(:misc :combobox);
|
||||||
use Wx::Event qw(EVT_COMBOBOX EVT_TEXT);
|
use Wx::Event qw(EVT_CHOICE EVT_COMBOBOX EVT_TEXT);
|
||||||
|
|
||||||
sub BUILD {
|
sub BUILD {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
@ -227,17 +227,20 @@ sub BUILD {
|
|||||||
if (defined $self->option->gui_type && $self->option->gui_type ne 'select_open') {
|
if (defined $self->option->gui_type && $self->option->gui_type ne 'select_open') {
|
||||||
$field = Wx::Choice->new($self->parent, -1, wxDefaultPosition, $self->_default_size,
|
$field = Wx::Choice->new($self->parent, -1, wxDefaultPosition, $self->_default_size,
|
||||||
$self->option->labels || $self->option->values || [], $style);
|
$self->option->labels || $self->option->values || [], $style);
|
||||||
|
EVT_CHOICE($self->parent, $field, sub {
|
||||||
|
$self->_on_change($self->option->opt_id);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$field = Wx::ComboBox->new($self->parent, -1, "", wxDefaultPosition, $self->_default_size,
|
$field = Wx::ComboBox->new($self->parent, -1, "", wxDefaultPosition, $self->_default_size,
|
||||||
$self->option->labels || $self->option->values || [], $style);
|
$self->option->labels || $self->option->values || [], $style);
|
||||||
|
EVT_COMBOBOX($self->parent, $field, sub {
|
||||||
|
$self->_on_change($self->option->opt_id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
$self->wxWindow($field);
|
$self->wxWindow($field);
|
||||||
|
|
||||||
$self->set_value($self->option->default);
|
$self->set_value($self->option->default);
|
||||||
|
|
||||||
EVT_COMBOBOX($self->parent, $field, sub {
|
|
||||||
$self->_on_change($self->option->opt_id);
|
|
||||||
});
|
|
||||||
EVT_TEXT($self->parent, $field, sub {
|
EVT_TEXT($self->parent, $field, sub {
|
||||||
$self->_on_change($self->option->opt_id);
|
$self->_on_change($self->option->opt_id);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user