in reply to tk::matchentry changing the displayed choices

The following (slightly pared down) code does the trick:

use strict; use warnings; use Tk; use Tk::MatchEntry; my @dataa = qw/Abberley Abberton Abbotsley Accrington/; my $place; my $mw = MainWindow->new (-title => "i wish this would work",); $mw->geometry ("200x70+0+0"); my $label = $mw->label ("type somthing in the box"); my $me; $me = $mw->MatchEntry ( -textvariable => \$place, -choices => \@dataa, -autosort => 0, -fixedwidth => 0, -ignorecase => 1, -maxheight => 10, -listwidth => 240, )->pack (-side => 'left'); Tk::MainLoop ();

Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: tk::matchentry changing the displayed choices
by gkx947n (Novice) on Jan 21, 2008 at 22:53 UTC
    Yes it does. But i want to be able to change the choices once the first character is typed in and if i have read the html that was packed wth the module correctly then this chould be possiable see http://search.cpan.org/~whom/Tk-MatchEntry-0.4/MatchEntry.pm and the option -onecmd Thanks -Daniel

      Why? Try typing 'B' as the first character with the following changed line in the code I gave above:

      my @dataa = qw/Abberley Abberton Abbotsley Accrington Babraham Bacton +Bexhill Bradfield/;

      Notice that the pick list shows only the entries matching the text typed so far. Is there some effect other than that you wish to achieve? Anything else could be mighty confusing for the user!


      Perl is environmentally friendly - it saves trees
        ok. that works but theres a but. i have a list of approx 16000 place names to populate this listbox with and with that many its quite slow. so i thought i would break it down and have 26 lists (one for each letter of the alphabet) and then load the appropriate one once i knew what the first letter was - Daniel