home *** CD-ROM | disk | FTP | other *** search
- clear
- trace off
-
- |-------------------------------------------------------------|
- | Sample AutoPilot for doing simple text menus in ST-Talk Pro |
- | by John DeMar 2/7/88 |
- |-------------------------------------------------------------|
- | Text menus use the Menu function for branching to one of |
- | several places in an Autopilot program. |
- | 1) Build arrays to hold the characters associated with each |
- | menu selection, the menu text for each selection and the |
- | labels to go to upon selecting the character. |
- | 2) Enter the labels and commands for each menu selection. |
- | 3) Fill the arrays with their associated data. |
- | 4) Do the Menu funtion. |
- |-------------------------------------------------------------|
-
- keys='a' | force keys to be a character data type.
- msgs="a" | force msgs to be a string data type.
- _labels | force labels to be a label type.
- array keys 5 | make the array for the menu keys.
- array msgs 5 | make the array for the menu messages.
- array labels 5 | make the array for the menu labels.
-
- @defer | Enclose labels for menus in a "do nothing" function.
- | This keeps autopilot from doing this lines the first time through.
- _labela
- print "~Doing label a.~"
- GOTO menu1
-
- _labelb
- print "~Doing label b.~"
- GOTO menu1
-
- _labelc
- print "~Doing label c.~"
- GOTO menu1
-
- _labeld
- print "~Doing label d.~"
- GOTO menu1
-
- _labele
- print "~Doing label e.~"
- GOTO more
-
- @endsub | End of the "do nothing" function.
-
- | Fill the keys array with menu selections' keys.
- keys[1]='a'
- keys[2]='b'
- keys[3]='c'
- keys[4]='d'
- keys[5]='e'
-
- | Fill the messages array with the menu text for each key.
- | Add some special text at the begining and end for esthestics.
- msgs[1]="~a) Do things at label a "
- msgs[2]= "b) Do things at label b"
- msgs[3]="~c) Do things at label c "
- msgs[4]= "d) Do things at label d"
- msgs[5]="~e) Do things at label e and exit~~ Select a,b,c,d or e >"
-
- | Fill the label array with the location to goto for each key value.
- labels[1]=labela
- labels[2]=labelb
- labels[3]=labelc
- labels[4]=labeld
- labels[5]=labele
-
- | A place to come back to when re-running the menu.
- _menu1
-
- | Run the menu and branch to the selected label!
- menu 0 keys labels msgs
- | Menu function should never get here unless there was a data type error!
- | or <undo> was pressed.
- Print "~Undo!~"
- QUIT
-
- |-----------------------------------------------------------
- _more | a place to go to when continuing with the program.
-
- Print "~Done!~" | Just say Done and
- QUIT | quit for now.
-
-
-
-