[futurebasic] A simple demo

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2000 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Wed, 03 May 2000 19:33:23 -0500
Here is a tiny program that you may find useful.  All it does is display a
little window which tells you when your Macintosh was last turned on or
rebooted.  It illustrates the use of the IUDATESTRING function.

Enjoy.
 - Rick

COMPILE 0, _caseInsensitive _dimmedVarsOnly
'-----------------------------------------------------------------
LOCAL FN PrettyTime$(seconds&)
  'Returns a string which contains the month, day, year, hour,
  'minutes and seconds as decoded from the seconds& parameter.
  '(seconds& = # of seconds since midnight, Jan 1, 1904).
  DIM 65 dateString$, 65 timeString$, 255 outString$
  CALL IUDATESTRING(seconds&, _longDate, dateString$)
  CALL IUTIMESTRING(seconds&, _true, timeString$)
  outString$ = dateString$ + "; " + timeString$
END FN = outString$
'----------------------------------------------------------------
LOCAL FN DoDialog
  DIM evnt, id
  evnt = DIALOG(0)
  id = DIALOG(evnt)
  SELECT CASE evnt
    CASE _wndClose
      END
  END SELECT
END FN
'----------------------------------------------------------------
WINDOW OFF
DIM wide, high, theString$
wide = 300: high = 100
WINDOW 1, "Last Reboot", (0,0)-(wide,high), _docNoGrow
TEXT _sysFont, 12
theString$ = FN PrettyTime$([_time] - INT(FN TICKCOUNT/60.15+.5))
theString$ = "This Macintosh was last rebooted on" + CHR$(13) + CHR$(13) + theString$
EDIT FIELD 1, theString$, (0,0)-(wide,high), _statNoFramed, _centerJust
ON DIALOG FN DoDialog
DO
  HANDLEEVENTS
UNTIL _false