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,
$mw->after( 'idle', [configure => $styleref_select_parent,
-background => 'cyan' ],
);
in this particular scenario can be replaced by:
$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
after(*ms*, *callback*?).
So how do these fit in to permit the syntax
2000=> configure => $tree 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
sub 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";
}
}
was replaced by
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";
}
}
);
}
and things just happen to work fine.
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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|
|