home *** CD-ROM | disk | FTP | other *** search
- *************************************************************************
- ** SAMPLES.PRG
- ** (C) Copyright 1990-92, Sub Rosa Publishing Inc.
- **
- ** A demonstration program provided to VP-Info users.
- ** This program may be copied freely. If it is used in commercial code,
- ** please credit the source, Sub Rosa Publishing Inc.
- **
- ** SAMPLES demonstrates the use of the MENU( function and calls a number
- ** of Info demonstration programs.
- **
- ** SAMPLES is compatible with all current versions of VP-Info.
- **
- ** SAMPLES displays a menu, determines the choice made, and takes
- ** action depending both on the selection and the key used to make
- ** the selection.
- **
- ** SAMPLES is the driver program for the INFO collection of sample
- ** programs. As such it is a complex program included more for the
- ** work it does than than the instruction is provides.
- **
- ** Sid Bursten and Bernie Melman
- ***************************************************************************
- SET library to samples
- SET talk off ;suppress VP-Info messages during programs
- SET echo off ;do not display program during compilation
- :serial=:color ; save to restore on way out
- IF :color=7 ; when original color=7, means we're monochrome
- ELSE
- :color=62 ; we must be in color
- ENDIF
- progname='MENU1'
- SET text on
- expnum=1
- codnum=2
- ON escape
- CURSOR 22,0
- CANCEL
- ENDON
- DO WHILE t ;put main menu in an infinite loop
- WINDOW ;cancel any pre-existing window
- ERASE ;fills window with blanks
- CLEAR gets
- WINDOW 5,22 ;start entry on row 5
- TEXT
- ╒═════════════════════════════════════════════════════════════════════════╕
- │ Use the Up Arrow and Down Arrow to "highlight" the option you want │
- │ and press ENTER to activate that choice, or press a number from 0-6 │
- │ to activate that choice immediately. │
- │ │
- │ SAMPLE PROGRAMS MENU │
- │ │
- │ 0. Exit to Conversational VP-Info │
- │ │
- │ 1. Introductory Programs │
- │ 2. Intermediate Programs │
- │ 3. Advanced Programs │
- │ 4. VP-Info Features Demonstration │
- │ 5. Programs that will work for you now │
- │ 6. Register your VP-Info │
- │ │
- ╘═════════════════════════════════════════════════════════════════════════╛
- ENDTEXT
- WINDOW
- CURSOR 14,20 ; positions menu cursor over 1st character of 1st choice
- group=menu(6,40) ;six choices menu bar width 40
- DO CASE
- CASE group=0 .or. :key=327 ; <home> key
- :color=:serial ;restore color
- CLS ;clear screen
- CANCEL
- CASE group=4
- CHAIN demo
- * CASE group=5
- * CHAIN workers
- CASE group=6
- CHAIN register
- CASE group=1
- WINDOW 5,23 ;start entry on row 5
- TEXT
- INTRODUCTORY PROGRAMS
-
- 0. Exit to the Main Samples Menu
-
- 1. Simple Menu Program
- 2. Better Menu Program
- 3. Edit/Browse Demonstration
- 4. Data Validation through ON FIELD
- 5. Sample List-Maintenance Program
- 6. Memo Field Support
-
- Use the Up Arrow and Down Arrow to
- "highlight" the option you want and
- press ENTER to activate that choice, or
- press a number from 0-4 (zero through four)
- to activate that choice immediately.
- ENDTEXT
- WINDOW
- CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
- ans=menu(6,40) ;four choices menu bar width 40
- DO CASE
- CASE ans=1
- progname='MENU1'
- expnum=77
- codnum=80
- CASE ans=2
- progname='MENU2'
- expnum=1
- codnum=2
- CASE ans=3
- progname='EDBROW'
- expnum=3
- codnum=4
- CASE ans=4
- progname='ONFIELD'
- expnum=5
- codnum=6
- CASE ans=5
- progname='MEMBERS'
- expnum=7
- codnum=8
- CASE ans=6
- progname='MEMODEMO'
- expnum=155
- codnum=156
- ENDCASE
- IF ans>0
- PERFORM options
- ENDIF
- CASE group=2
- WINDOW 5,23 ;start entry on row 5
- TEXT
- INTERMEDIATE SAMPLES PROGRAMS
-
- 0. Exit to the Main Samples Menu
-
- 1. Create Logon Screen in Program
- 2. Use Various Info Date Formats
- 3. Set Up Relation Between Files
- 4. Use the APPEND FROM Command
- 5. Simple 1-Across Label Program
- 6. Sound and Screen Special Effects
-
- Use the Up Arrow and Down Arrow to
- "highlight" the option you want and
- press ENTER to activate that choice, or
- press a number from 0-6 (zero through six)
- to activate that choice immediately.
- ENDTEXT
- WINDOW
- CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
- ans=menu(6,40) ;five choices menu bar width 40
- DO CASE
- CASE ans=1
- progname='SRILOGON'
- expnum=9
- codnum=10
- CASE ans=2
- progname='DATES'
- expnum=13
- codnum=14
- CASE ans=3
- progname='RELATION'
- expnum=15
- codnum=16
- CASE ans=4
- progname='APPFROM'
- expnum=17
- codnum=18
- CASE ans=5
- progname='ONELABEL'
- expnum=19
- codnum=20
- CASE ans=6
- progname='EFFECTS'
- expnum=11
- codnum=12
- ENDCASE
- IF ans>0
- PERFORM options
- ENDIF
- CASE group=3
- WINDOW 5,23 ;start entry on row 5
- TEXT
- ADVANCED SAMPLES PROGRAMS
-
- 0. Exit to the Main Samples Menu
-
- 1. Access Fields by Number, Not Name
- 2. Use Program to modify ASCII File
- 3. Use "Bit Arithmetic" in Info
- 4. A Complex Label Generator
-
- Use the Up Arrow and Down Arrow to
- "highlight" the option you want and
- press ENTER to activate that choice, or
- press a number from 0-4 (zero through four)
- to activate that choice immediately.
- ENDTEXT
- WINDOW
- CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
- ans=menu(4,40) ;four choices menu bar width 40
- DO CASE
- CASE ans=1
- progname='VECTOR'
- expnum=21
- codnum=22
- CASE ans=2
- progname='FILTERCR'
- expnum=23
- codnum=24
- CASE ans=3
- progname='BIT'
- expnum=25
- codnum=26
- CASE ans=4
- progname='LAB_GEN'
- expnum=27
- codnum=28
- ENDCASE
- IF ans>0
- PERFORM options
- ENDIF
- CASE group=5
- WINDOW 5,23 ;start entry on row 5
- TEXT
- A number of programs in the sample collection are useful as well
- as instructional. The List Maintenace and Label Generator
- Can be accessed from other menus.
-
- Some Programs to Use NOW!
-
- 0. Exit to the Main Samples Menu
-
- 1. A menu with screen saver
- 2. List-Maintenance Program
- 3. Labels from any data base
-
- Use the Up Arrow and Down Arrow to
- "highlight" the option you want and
- press ENTER to activate that choice, or
- press a number from 0-3 to activate
- that choice immediately.
- ENDTEXT
- WINDOW
- CURSOR 13,20 ; positions menu cursor over 1st character of 1st choice
- ans=menu(3,40) ;four choices menu bar width 40
- DO CASE
- CASE ans=1
- progname='MENUSAVE'
- expnum=143
- codnum=146
- CASE ans=2
- progname='MEMBERS'
- expnum=106
- codnum=8
- CASE ans=3
- progname='LAB_GEN'
- expnum=151
- codnum=28
- ENDCASE
- IF ans>0
- PERFORM options
- ENDIF
- ENDCASE
- ENDDO
- *
- PROCEDURE options
- DO WHILE t
- WINDOW 6,35,22,77 double
- TEXT
- You have chosen program &progname.
- Highlight option you want and press
- ENTER, or press a number from 0-7
- (zero through seven).
-
- 0. Return to SAMPLES menu
-
- 1. Run Program &progname
- 2. View Program Explanation
- 3. View Explanation of Info Code
- 4. Look at the Code in the Editor
- 5. Print Program Explanation
- 6. Print Explanation of Info Code
- 7. Print the Code
- ENDTEXT
- WINDOW
- CURSOR 13,37
- option=menu(7,40)
- DO CASE
- CASE option=0
- BREAK
- CASE option=1
- CHAIN &progname
- CASE option=2
- COLOR :color,0,0,24,79,177 ;fill screen with pattern of character 177
- @ 22,30 say ' Press spacebar . . . '
- WINDOW 3,19 ;declare space for text
- SET width to 80
- TEXT .expnum
- CURSOR 22,50
- ok=inkey()
- CASE option=3
- COLOR :color,0,0,24,79,177 ;fill screen with pattern of character 177
- @ 22,30 say ' Press spacebar . . . '
- WINDOW 3,19 ;declare space for text
- SET width to 80
- TEXT .codnum
- CURSOR 22,50
- ok=inkey()
- CASE option=4
- WRITE &progname
- CASE option=5
- IF printer()
- SET printer on
- WINDOW
- CLS
- SET width to 80
- TEXT .expnum
- EJECT
- SET print off
- ENDIF
- CASE option=6
- IF printer()
- SET printer on
- WINDOW
- CLS
- SET width to 80
- TEXT .codnum
- EJECT
- SET print off
- ENDIF
- CASE option=7
- IF printer()
- SPOOL &progname.prg to prn
- ENDIF
- ENDCASE
- ENDDO
- ENDPROC options
- *
- * *** end of SAMPLES.PRG ***