24 hour clock

Mike Bonner bonnmike at gmail.com
Wed Apr 6 15:40:35 EDT 2011


If you look at the twelvehourtime property it should help. If its set to
false then time is returned as a 24 hour value.

Once you have that set, if you have a field to display the time, you can
have something like

command timeLoop
put the long time into field "myClockField"
send timeLoop to me in 1 second
end timeLoop


If you want to be able to toggle it on and off with a button you can do
something like the following
This script is in a button named clockb, and I have a field named clockfield

local clockState -- track the staate of the clock, on or off
on mouseUp
   if clockstate is empty then -- on first run, set the clockstate, and the
twelvehourtime property
      put false into clockstate
      set the twelvehourtime to false
   end if
   put not clockstate into clockstate -- toggle the clockstate to on (or off
if its not the first run)
   clockToggle -- the command that updates the field
end mouseUp

command clockToggle
   set the label of button "clockb" to "Running:" && clockState -- changes
the button label to

            -- the the current state of the clock
   if clockState then -- if the clock is running
      put the long time into field "clockField" -- put the time into the
field
      send clockToggle to me in 1 second -- and call clocktoggle again in 1
second.
   end if
-- if the clock is not running (clockstate = false) there is no send in
time, and the clock stops.
end clockToggle

On Wed, Apr 6, 2011 at 12:32 PM, Glen Bojsza <gbojsza at gmail.com> wrote:

> I was wondering if anyone has a 24 hour clock in rev.
>
> It only needs to have the hours and minutes but if it also had seconds that
> would be great.
>
> thanks,
>
> Glen
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list