Bug in Tk::BrowseEntry [patch]
"Puetz Kevin A" <[email protected]> Wed, 22 Nov 2006 13:28:53 -0600
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
The operator precedence of "not" is lower than &&, so this test gets mis-parsed. This causes the combobox to not remember your previous selection when displaying the choices if is an undef item in the list of values (I like to do this when there is a "no selection" state). A simple fix is attached, as is a script showing the problem. The list should dropdown hilighting the 'val2' entry, but instead picks the undef one. --++**==--++**==--++**==--++**==--++**==--++**==--++**== ptk mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/ptk
Tk-BrowseEntry.diff
(application/octet-stream, 373 B)
--- BrowseEntry.old.pm 2004-03-26 12:49:12.000000000 -0600
+++ BrowseEntry.pm 2006-11-14 14:18:37.678277200 -0600
@@ -380,7 +380,7 @@
$hash{$val} = 1;
}
$old = $choices->[0]
- if defined $old && not exists $hash{$old} && defined $choices->[0];
+ if defined $old && !exists $hash{$old} && defined $choices->[0];
$$var = $old;
}
else
test.pl
(application/octet-stream, 237 B)
use Tk;
use Tk::BrowseEntry;
my $mw = Tk::MainWindow->new;
my $var = 'val2';
$browse = $mw->BrowseEntry(
-label => 'test',
-listcmd => sub { $_[0]->choices([undef, 'val1','val2']) },
-variable => \$var
)->pack;
MainLoop;