On Sun, 20 Sep 2009, Brian Schott wrote:
> Bill,
>
> I was about to ask you what to do in a timer verb when the count or
> time hit a threshold. That is what would I clear or restart? (and that
> may eventually be a question I would like an answer for.)
>
> But then I elected to reread this earlier message in which you said
> that the 'pactive' part of the wd command may not affect the 'graphic
> handle', so I tried omitting 'pactive' (which I had tried earlier, but
> something else may have been different).
>
> Anyhow, the result of removing 'pactive' is that I have even
> accomplished a `try 500` without any problems with the keystrokes in
> the graphics window while retaining the ability to run selections from
> either the ijs or ijx window. The one thing that I lose by omitting
> 'pactive' is that the graphics window is not automatically selected
> after the simulation ('try', in this case) finishes. Is there
> something I could add to the 'paint' to retain this finishing result
> without requiring a timer?
>
> Thanks, very much,
>
> On Wed, Sep 16, 2009 at 12:33 PM, bill lam <[email protected]> wrote:
> [---=| TOFU protection by t-prot: 22 lines snipped |=---]
Brian,
'paint verb' is a verb that will be executed when a 'paint event' occur, so
that 'try 500' should be directly call 'paint verb' 500 times but to
make 'paint event' to happen 500 times. For each time 'paint event'
occurs, the os (not you yourself) wll call that 'paint vern'.
A simple example of using timer. (not work under jconsole)
NB. a global noun
ntry__=: 10
NB. things to do in each step
sys_timer_z_=: 3 : 'smoutput ntry__=:<:ntry__'
NB. start timer, sys_timer_z_ will be executed every 5000ms (5 second)
wd 'timer 5000'
NB. and you wait, and will see it print and decrement ntry each 5 sec
NB. the timer will never stop, to stop the timer, you type
wd 'timer 0'
or you can change sys_timer so that it only executes for a fixed
number of times.
sys_timer_z_=: 3 : 0
if. 0=ntry__ do. wd 'timer 0' return. end.
smoutput ntry__=:<:ntry__
)
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm