Workaround wxWidgets not allowing SetValue() inside a EVT_COMBOBOX handler on Windows. #1865

visilibity
Alessandro Ranellucci 2014-04-19 18:42:52 +02:00
parent 8018eac0f0
commit 5d10ef514f
1 changed files with 5 additions and 2 deletions

View File

@ -205,8 +205,11 @@ sub _build_field {
$field->SetValue($_[0]);
};
EVT_COMBOBOX($self->parent, $field, sub {
$field->SetValue($opt->{values}[ $field->GetSelection ]); # set the text field to the selected value
$self->_on_change($opt_key, $on_change);
# Without CallAfter, the field text is not populated on Windows.
Slic3r::GUI->CallAfter(sub {
$field->SetValue($opt->{values}[ $field->GetSelection ]); # set the text field to the selected value
$self->_on_change($opt_key, $on_change);
});
});
EVT_TEXT($self->parent, $field, $on_change);
EVT_KILL_FOCUS($field, $on_kill_focus);