Skip to content

Commit

Permalink
Bugfix: wxComboBox left blank after menu item selection on MSW due to…
Browse files Browse the repository at this point in the history
… an undocumented wxWidgets issue. #2361
  • Loading branch information
alranel committed Dec 13, 2014
1 parent e9166a8 commit b0aa126
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/Slic3r/GUI/OptionsGroup/Field.pm
Expand Up @@ -231,7 +231,7 @@ use Moo;
extends 'Slic3r::GUI::OptionsGroup::Field::wxWindow';

use List::Util qw(first);
use Wx qw(:misc :combobox);
use Wx qw(wxTheApp :misc :combobox);
use Wx::Event qw(EVT_COMBOBOX EVT_TEXT);

sub BUILD {
Expand All @@ -258,7 +258,17 @@ sub BUILD {
$label = $value;
}

$field->SetValue($label);
# The MSW implementation of wxComboBox will leave the field blank if we call
# SetValue() in the EVT_COMBOBOX event handler, so we postpone the call.
wxTheApp->CallAfter(sub {
my $dce = $self->disable_change_event;
$self->disable_change_event(1);

# ChangeValue() is not exported in wxPerl
$field->SetValue($label);

$self->disable_change_event($dce);
});

$self->disable_change_event($disable_change_event);
$self->_on_change($self->option->opt_id);
Expand Down

0 comments on commit b0aa126

Please sign in to comment.