in reply to Re^5: A question on using Tk::ItemStyle in Tk::Tree
in thread A question on using Tk::ItemStyle in Tk::Tree
I was waiting and hoping if choroba would also respond. Anyway, this kind of detailed response from you does help for newbie like me. I had to repeatedly read through your response and hence it took me sometime to go through the after call details you specified.
- Now it appears to me that this afterIdle construct,
in this particular scenario can be replaced by:$mw->after( 'idle', [configure => $styleref_select_parent, -background => 'cyan' ], );
$styleref_select_parent->configure(-background => 'cyan');
Is my observation correct ?(after all I got the same output) If not, is there any advantage in going for a Tk::After call? - Refering to your last example: As per the docs,
(on Tk::Callbacks) the callback when using methodname has the syntax,
... => ['methodname', args... ] ...
and the Tk::after method has the syntax
So how do these fit in to permit the syntax 2000=> configure => $treeafter(*ms*, *callback*?).
in your code:
$mw->after( 2000 => configure => $tree, -background => 'green' ); ? - I'm eagerly trying to get a handle in understanding this afterIdle method. So I chanced to come across the problem Table matrix suspected selected cell discrepancy and the solution to it Tablematrix 'odd' behaviour of mouse and key solved.
where the method
was replaced bysub brscmd { my ($previous_index, $actual_index) = @_; my ($row, $col) = split ',', $actual_index; my ($sel, $js); $sel = $t->curselection(); # <-- THE PROBLEM print "@$sel\n"; foreach $js (@$sel) { print "\n[brscmd] actual index <$actual_index> from curselection <$js>\n"; } }
and things just happen to work fine.sub brscmd { my ($previous_index, $actual_index) = @_; my ($row, $col) = split ',', $actual_index; my ($sel, $js); $t->after( 'idle', # <-- THE SOLUTION sub{ my $sel = $t->curselection(); print "@$sel\n"; foreach $js (@$sel) { print "[brscmd] actual index <$actual_index> from curselection <$js> last_button_key <$last_button_key>\n"; } } ); }
But I'm unable to grasp the idea behind using afterIdle call here.
I realize that the number of monks responding to questions on Perl/Tk is generally less than what is comes to other areas of Perl. Since last week the count is again down by 1 after very useful zentara bid adieu to PM.
So any information monks provide, I say sincerely, will be useful indeed.
Many Thanks
In Section
Seekers of Perl Wisdom