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 |