Force unfocusing of all input fields when saving a preset, otherwise the currently focused one might be ignored. #750 #624

This commit is contained in:
Alessandro Ranellucci 2012-10-22 16:03:08 +02:00
parent c793a2657f
commit 28b56ae840

View File

@ -85,6 +85,12 @@ sub new {
}); });
EVT_BUTTON($self, $self->{btn_save_preset}, sub { EVT_BUTTON($self, $self->{btn_save_preset}, sub {
# since buttons (and choices too) don't get focus on Mac, we set focus manually
# to the treectrl so that the EVT_* events are fired for the input field having
# focus currently. is there anything better than this?
$self->{treectrl}->SetFocus;
my $preset = $self->current_preset; my $preset = $self->current_preset;
my $default_name = $preset->{default} ? 'Untitled' : basename($preset->{name}); my $default_name = $preset->{default} ? 'Untitled' : basename($preset->{name});
$default_name =~ s/\.ini$//i; $default_name =~ s/\.ini$//i;