Now, this simulates the problem quite well. I have tested with threads::shared and Thread::Queue::Any (both on a more complex @choices (with hashes in it aswell. Remember, this is a shortened version), and on the $full_PathMatchEntry widget), but no progress! I have also tested with POE, but no real progress there either! As you may see here, the idea is to change the @choices array (or somehow beeing able of changing the data which -choices points too), so the $full_PathMatchEntry shows the new data when doing ->show_listbox().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('<KeyPress>', [ sub { shift; my $w = shift; $w->show_listbox() +; print Dumper($full +_PathMatchEntry->cget(-choices)); }, $full_PathMatchEntr +y ] ); 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", "23 +4232" ] ); $$full_PathCompactMatchEntry_ref->configure(-choices => \@b +ah); #${$full_PathCompactMatchEntry_ref}->show_listbox(); #print Dumper(${$full_PathCompactMatchEntry_ref}->cget(-choice +s)); } }
In reply to Annoying threads share problem! by Ace128
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |