in reply to Re: tk::matchentry scrollbars
in thread tk::matchentry scrollbars
if in the entry box i enter an 'a' then i get the list of 11 places starting with 'a' with a scrollbaruse strict; use warnings; use Tk; use Tk::MatchEntry; my %data = ( a => [qw/Abberley Abberton Abbotsley Aberaeron Abergele Abingdon A +ccrington Achany Acton Adderley Airth/], b => [qw/Babraham Bacton Barrow Barry Barton Baslow Bath Battle Ba +xenden Bexhill Bradfield/] ); my $place; my $mw = MainWindow->new (-title => "i wish this would work",); $mw->bind('<Configure>' => sub{ my $xe = $mw->XEvent; $mw->maxsize($xe->w, $xe->h); $mw->minsize($xe->w, $xe->h); }); my $me = $mw->MatchEntry ( -textvariable => \$place, -choices => [keys %data], -ignorecase => 1, -maxheight => 10, -onecmd => \&repopulate, # -entercmd => \&calc, )->pack (-side => 'left'); my $me_subwidget = $me->Subwidget('entry'); $me_subwidget->configure(-width => '41', -label => 'Starting at ', ); my $c = $mw->Button( -text => "Exit", -command => sub { $mw->destroy; exit; }, ); $c->pack(-anchor => 'se', -padx =>10, -pady =>30, -expand => 1 ); Tk::MainLoop (); sub repopulate { return unless exists $data{lc $place}; $me->configure (-choices => $data{lc $place}); }
|
|---|