in reply to tk::matchentry scrollbars

You really didn't show a complete working example, so I can only offer a few things to try.

1. After adjusting the number of entry choices, do a $me->update or even possibily a $mw->update. That "SHOULD" reset the scrollbars automatically.

2. If that dosn't work, file a bug report. You shouldn't have to subclass the MatchEntry, because it should work.

Show a complete snippet so we can see exactly what you code is doing.


I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: tk::matchentry scrollbars
by gkx947n (Novice) on Feb 04, 2008 at 13:54 UTC
    Thankyou for taking the trouble to reply
    here is a section of code that should demonstrate what i mean
    use 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}); }
    if in the entry box i enter an 'a' then i get the list of 11 places starting with 'a' with a scrollbar
    if i then enter a 'b' it reduces the list to the 6 places starting 'ab'.
    so far so good.
    if i then delete the b using the backspace or delete key the list expands back to the original 11 items but the scroll bar vanishes never to be seen again.
    the only way round this i have found is to modify the matchenty.pm as in my original post i hope this makes more sense
    Daniel