MENUS

 BBS: Inland Empire Archive
Date: 01-31-93 (21:20)             Number: 399
From: MARK BUTLER                  Refer#: NONE
  To: JOHN GREAVES                  Recvd: NO  
Subj: MENUS                          Conf: (2) Quik_Bas
Once upon a time John Greaves uttered these sage words to Eric Mays:

 JG> Hi Eric,
 JG> In a letter to all you asked how to
 EM> GET A CLOCK ON THE SCREEN.
 JG> I am sure there are lots of ways. here is one

 JG> SUB printtime
 JG> tx$ = LEFT$(TIME$, 2)
 JG> SELECT CASE tx$
 JG> CASE IS = "00": t1$ = "12"
 JG> CASE IS = "01": t1$ = "1"
 JG> CASE IS = "02": t1$ = "2"

 Phew! If I had half of those 'cases' I could open a beer store! <g>
 You could simplify this a great deal like so...

==========================8< Cut Here 8<=============================
 DECLARE FUNCTION Clock$ ()

    CLS
    COLOR 0, 7
    LOCATE 1, 1
    PRINT SPACE$(80);
    LOCATE 1, 30
    PRINT "Clock will update once per minute => "
    GOSUB ClockDisplay
    COLOR 7, 0

    TIMER ON                        '*** Enable timer-event trapping.
    ON TIMER(60) GOSUB ClockDisplay '*** Once every 60 secs the clock
                                    '*** display will be updated.
    DO
        LOCATE 12, 20
        PRINT "Simulated application running :"; TIMER
    LOOP UNTIL INKEY$ = CHR$(27)
    END

ClockDisplay:

    LOCATE 1, 73
    COLOR 1, 7
    PRINT Clock$
    SOUND 750, 1
    SOUND 550, 1
    COLOR 7, 0
    RETURN

 FUNCTION Clock$
 '*** This is the function I wanted to show you,
 '*** the following is all you really have to do to get a
 '*** standard time display (am-pm type) into a string.
 '*** The other stuff above is just some code to demonstrate it.
    Hour = VAL(LEFT$(TIME$, 2))
    IF Hour < 12 THEN
        AmPm$ = "am"
    ELSEIF Hour >= 12 THEN
        Hour = Hour - 12
        AmPm$ = "pm"
    END IF
    IF Hour = 0 THEN Hour = 12
    Minute$ = MID$(TIME$, 3, 3)
    Clock$ = LTRIM$(STR$(Hour)) + Minute$ + AmPm$
 END FUNCTION
==========================8< Cut Here 8<=============================


תש [-M-H-B-] שת

--- timEd/B7 * Don't hate yourself in the morning, sleep till noon!
 * Origin:  MotherShip Portholes, Portland OR  (1:105/319.32)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET