in reply to Re^2: A question on using Tk::ItemStyle in Tk::Tree
in thread A question on using Tk::ItemStyle in Tk::Tree
Replies are listed 'Best First'. | |
---|---|
Re^4: A question on using Tk::ItemStyle in Tk::Tree
by Anonymous Monk on Nov 01, 2014 at 09:49 UTC | |
Thanks for pointing me to this Tk::after. However, I must honestly admit that I'm having difficulty in understanding the docs. Firstly, the after method has only two forms. Secondly, the second parameter is the callback whose execution has to be delayed. But in Khen1950fx's construct the method after is called on an instance of MainWindow and does not specify any name of the callback method whose execution is to be delayed. But fundamentally speaking though, how does delaying the execution of a callback get helpful? I'm unable to find any other docs on this. So please let me know. Thanks in advance | [reply] [d/l] [select] |
by Loops (Curate) on Nov 01, 2014 at 11:47 UTC | |
choroba will likely come along with some more details for you, but maybe this will suffice for now, given:
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:
The See Also links to Tk::callbacks where it shows the valid ways to specify a callback, one of which is:
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:
| [reply] [d/l] [select] |
by Anonymous Monk on Nov 05, 2014 at 08:13 UTC | |
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. 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 | [reply] [d/l] [select] |
by Loops (Curate) on Nov 05, 2014 at 20:31 UTC |