Hey Monks,

Ok, I have tested and tested and tested, trying to make this work, but no luck. I've managed to shorten the quite large and complex applictaion to the following lines:
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)); } }
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().

I'm totally out of ideas here now, as I've managed to make this work with less compless data (as standard $scalars). That is, sending the reference to the thread and read/change them. This also goes with widgets like JComboBox.

What/Why is something with $full_PathCompactMatchEntry_ref undefined when doing ${$full_PathCompactMatchEntry_ref}->configure(-choices => \@bah);?

And what is
"Attempt to free non-existent shared string '_TK_RESULT_', Perl interpreter: 0x25 6b72c at C:\Perl\site\lib/Tk/After.pm line 33."
all about? (I suspect it wants to free the @bah variable...?)

Suggestions to good debug tools for this is also good to know about!

Solvations? I would prefer to somehow beeing able of accessing the whole $full_PathMatchEntry from the searchUpdate thread. That way I have more I can do, than just sharing the data variable! (but now I get "Tk::Error: Can't call method "Call" on an undefined value at C:/Perl\site\lib/Tk/After.pm line 89."

Oh, and yes, I know about the ->after function you can do in Tk. But I dont have use of that here. I must have the searchUpdate as another thread, else the application isn't as smooth...

Thanks,
Ace

In reply to Annoying threads share problem! by Ace128

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.