note
Loops
<p>[choroba] will likely come along with some more details for you, but maybe this will suffice for now, given:</p>
<blockquote><c>
$mw->after( 'idle',
[ configure => $styleref_select_parent, -background => 'cyan' ],
);
</c></blockquote>
<p>Even though it could be made more clear, we do see in the [metamod://Tk::after#Internal-Details|Internal Details] documentation:</p>
<blockquote>
$time is the string 'idle', representing an idle queue timer, or a integer millisecond value.
</blockquote>
<p>If you never wanted to use that idle string anomaly, there is an ->afterIdle method. The equivalent of the above could be coded:</p>
<c>
$mw->afterIdle([ configure => $styleref_select_parent, -background => 'cyan' ]);
</c>
<br/>
<p>The [metamod://Tk::after#SEE-ALSO|See Also] links to [metamod://Tk::callbacks] where it shows the valid ways to specify a callback, one of which is:</p>
<blockquote><c>
[ 'methodname', args... ], ...
</c></blockquote>
<p>So going back to the sample from [id://1105715|Khen1950fx], we see that he passes 'configure', as the method name, and $styleref_select_parent as the object reference that will be passed as the first argument to Tk::ItemStyle::configure, along with the with arguments to change the background color. Incidentally, the fact that after() method is attached to the "$mw" object means that the timer will be cancelled if the MainWindow is destroyed before it fires.</p>
<p>Here's one last example, that shows the square brackets turn out to be optional in this case, as well. After two seconds, set the entire background color:</p>
<c>
$mw->after( 2000 => configure => $tree, -background => 'green' );
</c>
1105629
1105786