* Name : MENU.prg * Author : Kim Moser (v861222) * System : dBase III+ * Descrip: Generic menu shell for dBase III+ applications. * '@@@' indicates that programmer must supply relevant info * before executing. * set talk OFF set stat OFF * store 0 to KIM do while KIM <> 9 set talk OFF set device to SCREEN set print OFF set color ON set date AMERICAN set century OFF HOWMANY=9 set color to clear * Seconds to wait before refreshing: REFRESH=60 * Seconds of refresh time: DELAY=20 * * @@@ Main Menu choices: A1="First menu choice" A2="Second menu choice" A3="Third menu choice" A4="Fourth menu choice" A5="Fifth menu choice" A6="Sixth menu choice" A7="Seventh menu choice" A8="Eighth menu choice" A9="Exit system" * * @@@ Global screen coordinates of Main Menu choices: X1=15 Y1=13 X2=16 Y2=13 X3=17 Y3=13 X4=18 Y4=13 X5=15 Y5=48 X6=16 Y6=48 X7=17 Y7=48 X8=18 Y8=48 X9=19 Y9=34 * * @@@ Program file names corresponding to menu choices FI1="PROG1.PRG" FI2="PROG2.PRG" FI3="PROG3.PRG" FI4="PROG4.PRG" FI5="PROG5.PRG" FI6="PROG6.PRG" FI7="PROG7.PRG" FI8="PROG8.PRG" * * @@@ Write main menu screen here set color to B/B+ * @@@ Remove comments if you want to 'pop' a box open here * @ YA,XA to YB,XB DOUBLE * do while xa>=1 * xa=xa-1 * xb=xb+1 * ya=ya-1 * yb=yb+1 * set color to B/B * @ YA+1,XA+1 to YB-1,XB-1 * set color to B/B+ * @ YA,XA to YB,XB DOUBLE * enddo * Box surrounding menu choices: set color to BG/N YA=17 XA=34 YB=17 XB=45 set color to BG/N * @ YA,XA to YB,XB * do while YA>=15 * YA=YA-1 * XA=XA-10 * YB=YB+1 * XB=XB+10 * set color to X/X * @ YA+1,XA+10 to YB-1,XB-10 * set color to BG/N * @ YA,XA to YB,XB * enddo @ 14,4 to 20,75 * * Print choices: set color to W/N store 1 to LOOP do while LOOP <= HOWMANY store "X"+LTRIM(STR(LOOP))+",Y"+LTRIM(STR(LOOP)) to COORD store "A"+LTRIM(STR(LOOP)) to VAR XMAC="X"+LTRIM(STR(LOOP)) YMAC="Y"+LTRIM(STR(LOOP)) set color to BG/N @ &XMAC,&YMAC-3 say LTRIM(STR(LOOP))+"." set color to W/N @ &XMAC,&YMAC say &VAR store LOOP+1 to LOOP enddo * set color to W+/N @ 22,0 say "Use the "+CHR(24)+" and "+CHR(25)+" keys to highlight your choice, and press RETURN ("+CHR(17)+CHR(196)+CHR(217)+") when done." @ 23,18 say "Or, type the number (1 - "+LTRIM(STR(HOWMANY))+") of your choice." * store 1 to KIM,OLD set color to N/W @ X1,Y1 say A1 G=0 TIMER=0 clear TYPEAHEAD do while G<>13 .AND. (G<49 .OR. G>(49+HOWMANY-1)) .AND. TIMER5 .AND. G<>24 .AND. G<>13 .AND. (G<49 .OR. G>(49+HOWMANY-1)) .AND. TIMERTI2 TIMER=TIMER+1 set color to W/N store CDOW(DATE())+", "+CMONTH(DATE())+" "+LTRIM(STR(DAY(DATE())))+", "+LTRIM(STR(YEAR(DATE())))+" at " to TI2 store VAL(LEFT(TIME(),2)) to TIX * Determine which half of day it is [am or pm] if TIX>=12 store " pm" to HALF if TIX<=16 * "Afternoon" if 12 Noon - 4:59:59 pm store "Good afternoon. It's "+TI2 to TI2 else * "Evening" if 5:00 pm - 11:59:59 pm store "Good evening. It's "+TI2 to TI2 endif else store " am" to HALF * "Morning" if 12:00 am - 11:59:59 am store "Good morning. It's "+TI2 to TI2 endif * Convert 24-hr clock to 12-hr clock, if necessary if TIX>=13 * If 1pm or later [convert 24-hr clock to 12-hr clock]: store TI2+LTRIM(STR(VAL(LEFT(TIME(),2))-12))+RIGHT(TIME(),6)+HALF to TI2 else if TIX>=1 * If between 1am and 12:59:59pm, inclusive [24-hr clock same as 12-hr clock]: store TI2+LTRIM(STR(VAL(LEFT(TIME(),2))))+RIGHT(TIME(),6)+HALF to TI2 else if TIX=0 * If past midnite [convert 24-hr clock "00:xx:xx" to "12:xx:xx am"]: store TI2+"12"+RIGHT(TIME(),6)+HALF to TI2 endif endif endif store SPACE((80-LEN(TI2))/2)+TI2+SPACE((80-LEN(TI2))/2) to TI2 @ 21,0 say TI2 store TIME() to TI2 endif G=INKEY() enddo if G=5 OLD=KIM KIM=KIM-1 if KIM<1 KIM=HOWMANY endif else if G=24 OLD=KIM KIM=KIM+1 if KIM>HOWMANY KIM=1 endif endif endif * COORD="X"+LTRIM(STR(OLD))+",Y"+LTRIM(STR(OLD)) VAR="A"+LTRIM(STR(OLD)) set color to W/N @ &COORD say &VAR COORD="X"+LTRIM(STR(KIM))+",Y"+LTRIM(STR(KIM)) VAR = "A"+LTRIM(STR(KIM)) set color to N/W @ &COORD say &VAR enddo * * @@@ Remove comments to iris out screen after menu choice made: * set color to N/N * YA=0 * XA=0 * YB=24 * XB=79 * do while YA<=12 * @ YA,XA to YB,XB * YA=YA+1 * XA=XA+1 * YB=YB-1 * XB=XB-1 * enddo set color to clear if TIMER>=REFRESH @ 12,15 say "Refreshing screen....Press any key to continue...." store TIME() to TI1 TIMER2=0 do while TIMER2TIME() TIMER2=TIMER2+1 store TIME() to TI1 endif if INKEY()<>0 store DELAY to TIMER2 endif enddo endif * * Convert KIM if number key was pressed if G>=49 .AND. G<=49+HOWMANY store G-48 to KIM endif * if KIM>=1 .AND. KIM <=HOWMANY-1 .AND. TIMER when done...." ? quit return