use Tk; use Tk::MatchEntry; use threads; #use Time::HiRes qw( usleep ); use Data::Dumper; use strict; use warnings; my $mw = MainWindow->new(-title => "MatchEntry Test"); my @choices = ( ["01234", "345345", "64364"], ["abcsdf", "3waaxx", "6azz4"], ["aaac4", "aaaaabbbbbbbbb", "aaaaaadddddd"] ); #print Dumper(@choices); my $full_PathMatchEntry = $mw->MatchEntry ( -width => 10, -choices => \@choices, -autopopup => 0, -complete => 1, -ignorecase => 1, -maxheight => 15, -background => "#FFFFFF" )->pack(-fill => 'x', -expand => 1, -side => 'left'); threads->create('searchUpdate', \$full_PathMatchEntry); $full_PathMatchEntry->focus; $full_PathMatchEntry->bind('', [ sub { shift; my $w = shift; $w->show_listbox(); print Dumper($full_PathMatchEntry->cget(-choices)); }, $full_PathMatchEntry ] ); print "Choices: " . Dumper($full_PathMatchEntry->cget(-choices)) . "\n"; MainLoop; sub searchUpdate { #my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ]; my $full_PathCompactMatchEntry_ref = shift; #print Dumper(${$full_PathCompactMatchEntry_ref}->cget(-choices)); #print Dumper($full_PathCompactMatchEntry_ref); while (1) { sleep 1; my @bah; #my $bah = ${$full_PathCompactMatchEntry_ref}->cget(-choices); #@{$full_PathCompactMatchEntry_ref->cget(-choices)} = (); #push (@{$full_PathCompactMatchEntry_ref->cget(-choices)}, [ "/dfgsdfgsdfgsfse/ertuy/" , "3534235523", "234232" ] ); push (@bah, [ "/dfgsdfgsdfgsfse/ertuy/" , "3534235523", "234232" ] ); $$full_PathCompactMatchEntry_ref->configure(-choices => \@bah); #${$full_PathCompactMatchEntry_ref}->show_listbox(); #print Dumper(${$full_PathCompactMatchEntry_ref}->cget(-choices)); } }