Time field (please help)

Rob Cozens rcozens at pon.net
Sun Mar 3 12:00:02 EST 2002


>>>> How do you get the field to display live time?
>>>
>>> Try using <on idle >in the script of the field.
>>
>>The use of 'on idle' should be avoided. Instead, write a handler in the
>>script of the field that is called by an openCard handler:
>>
>>send updateTime to field "Now"
>>
>>and let the handler call itself in 1 second:
>>
>>on updateTime
>>  put the long time into me
>>  send updateTime to me in 1 second
>>end updateTime
>
>Terry, Björnke, et al:
>
>Question:  What happens when the user goes to another card or another
>stack?  Must one take some action on closeCard/closeStack to stop
>updateTime from continuing to send messages every second?

I'd still like to hear what other have to say about this; but perhaps
something like this is preferable:

on updateTime
   if there is a field "Now" then
      put the long time into field "Now"
      send updateTime to field "Now" in 1 second
  end if
end updateTime

Any comments?

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the use-livecode mailing list