Classic Computer Magazine Archive COMPUTE! ISSUE 49 / JUNE 1984 / PAGE 139

Apple Input And Menu Screens

Dan Jordan

The screen formatting and menu display techniques demonstrated here will your Apple programs easier to use.

Menus and formatted screens are two excellent ways to make programs more user-friendly. The two programs included here are simple examples of these techniques.

The "Menu Screen" routine (Program 1) generates a menu and uses a selection bar to help the user choose program functions. To create the illusion of movement by the selection bar, lines 370-390 blot out the existing bar, and lines 310-340 place a new bar on the next line.

The "Input Screen" routine (Program 2) prints a form on the screen and indicates, by the length of the inverse blank field, the amount of data to be entered. A subroutine can be added to check for field length, if desired. The correction routine (lines 500-570) lets you correct a data section without affecting any other part of the program.

PRINT CHR$(7) rings a bell, prompting the user to answer a question printed on the screen. Using GET rather than INPUT saves keystrokes in answering these screen prompts (the RETURN key need not be hit to enter data that is input with a GET).

Program 1: Menu Screen Routine

170 CLEAR
190 HOME
200 PRINT "********* MENU ***********"
210 PRINT "1-STEP NUMBER 1"
220 PRINT "2-STEP NUMBER 2"
230 PRINT "3-STEP NUMBER 3"
240 PRINT "4-STEP NUMBER 4"
250 PRINT "5-STEP NUMBER 5"
260 PRINT "6-STEP NUMBER 6"
270 PRINT : PRINT
280 PRINT "HIT (RETURN) TO SELECT —OR—"
290 PRINT "HIT ANY OTHER KEY TO CHANGE SELECTION"
300 I = 2
310 VTAB I
315 HTAB 17
320 INVERSE
330 PRINT "	";
340 NORMAL
350 GET X$
360 IF X$ = CHR$ (13) THEN Y = I - 1: GOTO 490
370 VTAB I
380 HTAB 17
390	PRINT " "
400 I = I + 1
410 IF I > = 8 THEN I = 2
420 GOTO 310
500 ON Y GOTO 1000, 2000, 3000, 4000, 5000, 6000
1000 REM STEP NO.1 PROCEDURES
1010 PRINT "STEP NO. 1"
1020 GOTO 7000
2000 REM STEP NO. 2 PROCEDURES
2010 PRINT "STEP NO. 2"
2020 GOTO 7000
3000 REM STEP NO. 3 PROCEDURES
3010 "STEP NO. 3"
3020 GOTO 7000
4000 REM STEP NO. 4 PROCEDURES
4010 "STEP NO. 4"
4020 GOTO 7000
5000 REM STEP NO. 4 PROCEDURES
5010 "STEP NO. 5"
5020 GOTO 7000
6000 REM STEP NO. 6 PROCEDURES
6010 "STEP NO. 6"
6020 GOTO 7000
7000 END

Program 2: Input Screen Routine

180 CLEAR
190 DIM A$ (5, 100)
200 HOME
210 PRINT "*****NAME & ADRRESS INPUT *****"
220 PRINT "1-NAME----------"
230 PRINT "2-ADDRESS LINE 1"
240 PRINT "3-ADDRESS LINE 2"
250 PRINT "4-CITY STATE ZIP"
260 PRINT "5-TELEPHONE NO.-"
270 FOR I= 2 TO 6
280 VTAB I
290 HTAB 17
300 INVERSE
310 PRINT "    	"
320 NORMAL
330 NEXT I
335 X = 1
340 FOR I = 2  TO 6
345 VTAB I: HTAB 17
350 INPUT A$ (I - 1, X)
360 NEXT I
370 PRINT : ORINT CHR$ (7)
380 PRINT "DO YOU WISH TO MAKE A CORRECTION (Y OR N)?";
390 GET X$
400 IF X$ = "Y" THEN GOTO 500
410 IF X$ = "N" THEN GOTO 450
420 VTAB 7: GOTO 370
450 PRINT CHR$ (7);
460 PRINT "DO YOU HAVE ANY MORE TO ENTER (Y OR N)?";
470 GET X$
480 IF X$ = "N" THEN GOTO 1000
485 IF X$ = "Y" X = X + 1; THEN GOTO 200
500 PRINT CHR$ (7);
510 PRINT "ENTER LINE NUMBER YOU WISH TO CORRECT";
520 GET Y
530 Y = Y + 1
540 VTAB Y
550 HTAB 17
560 INPUT A$ (Y -1, X)
570 VTAB 7
580 GOTO 370
1000 REM PRINT OR SAVE TO DISK
1010 END