in reply to Re^4: A question on using Tk::ItemStyle in Tk::Tree
in thread A question on using Tk::ItemStyle in Tk::Tree
choroba will likely come along with some more details for you, but maybe this will suffice for now, given:
$mw->after( 'idle', [ configure => $styleref_select_parent, -background => 'cyan' ], );
Even though it could be made more clear, we do see in the Internal Details documentation:
$time is the string 'idle', representing an idle queue timer, or a integer millisecond value.
If you never wanted to use that idle string anomaly, there is an ->afterIdle method. The equivalent of the above could be coded:
$mw->afterIdle([ configure => $styleref_select_parent, -background => +'cyan' ]);
[ 'methodname', args... ], ...
So going back to the sample from 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.
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:
$mw->after( 2000 => configure => $tree, -background => 'green' );
|Replies are listed 'Best First'.|
Re^6: A question on using Tk::ItemStyle in Tk::Tree
by Anonymous Monk on Nov 05, 2014 at 08:13 UTC
by Loops (Curate) on Nov 05, 2014 at 20:31 UTC