home *** CD-ROM | disk | FTP | other *** search
- ' ACPTDEMO.BAS
- ' This is a demo of the accept at routines. The following source
- ' programs must be on your disk prior to compiling the demo:
- ' PROMPT.BAS, P.BAS, GETDATA.BAS, and INPUT.BAS.
- '
- ' You must also designate the ADVBAS library (ADVBAS v3.4) when
- ' loading QuickBASIC: qb /l ADVBAS.EXE or qb87 /ADVBAS.EXE.
- '
- ' The ACCEPTAT routines run under QB v 3.0 only.
- '
- ' This program was written for a MONOCHROME monitor and revisions
- ' might be necessary for COLOR monitors in the attribute definitions
- ' found in the PROMPT subprogram.
- '
- COMMON SHARED true%, false%
-
- ' Initialize
- true% = -1: false% = 0
-
- ' Set up any desired strings to designate valid input.
- ualpha$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- lalpha$ = "abcdefghijklmnopqrstuvwxyz"
- alpha$ = ualpha$ + lalpha$
- digit$ = "0123456789"
- numeric$ = digit$ + ".+-E"
- punctuation$ = ".,':;?/()* "
-
- ' Set up the field prompts to be used
- namePrompt$ = " Customer Name: "
- streetPrompt$ = "Street Address: "
- cityPrompt$ = " City: "
- statePrompt$ = " State: "
- zipPrompt$ = " Zip Code: "
-
- ' The following represents an existing set of data
- name$ = "Doggie Biscuits, Inc." 'max 25 chars
- street$ = "3345 Industrial Pky." 'max 25 chars
- city$ = "DuBuque" 'max 25 chars
- state$ = "IA" 'max 2 chars
- zip$ = "52001" 'max 5 chars
-
- ' Display the prompts and existing data
- LOCATE 5, 20: PRINT namePrompt$ + name$
- LOCATE 7, 20: PRINT streetPrompt$ + street$
- LOCATE 9, 20: PRINT cityPrompt$ + city$
- LOCATE 11,20: PRINT statePrompt$ + state$
- LOCATE 11,40: PRINT zipPrompt$ + zip$
-
- ' Display control key functions
- LOCATE 14,10
- PRINT STRING$(60,205)
- LOCATE 16,10
- PRINT "Ins - toggels insert mode Del - deletes a character"
- LOCATE 18,10
- PRINT "Esc - restores original data BkSp - destructive backspace"
- LOCATE 20,10
- PRINT " ";CHR$(27);" - moves left";TAB(41);CHR$(26);" - moves right"
- LOCATE 22,25
- PRINT "Press ENTER to accept data"
- LOCATE 24,25
- PRINT "To Stop Press CONTROL BREAK";
- Start:
-
- ' Accept customer name
- ptype% = 2 'make prompt high intensity
- rtype% = 3 'make response reverse video
- sc% = 176 'use CHR$(176) to fill extra response positions
- r% = 5: c% = 20: maxLen% = 25
- CALL PROMPT(r%, c%, namePrompt$, name$, maxLen%, ptype%, rtype%, sc%)
- ' Note: r% and c% are left pointing to first response byte
- goodinpt$ = alpha$ + digit$ + punctuation$
- CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
- CALL GETDATA(r%, c%, maxLen%, name$, sc%)
- LOCATE 5,20: CALL CLREOL: PRINT namePrompt$ + name$
-
- ' Accept street address
- r% = 7: c% = 20: maxLen% = 25
- CALL PROMPT(r%, c%, streetPrompt$, street$, maxLen%, ptype%, rtype%, sc%)
- goodinpt$ = alpha$ + digit$ + punctuation$
- CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
- CALL GETDATA(r%, c%, maxLen%, street$, sc%)
- LOCATE 7,20: CALL CLREOL: PRINT streetPrompt$ + street$
-
- ' Accept city
- r% = 9: c% = 20: maxLen% = 25
- CALL PROMPT(r%, c%, cityPrompt$, city$, maxLen%, ptype%, rtype%, sc%)
- goodinpt$ = alpha$ + punctuation$
- CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
- CALL GETDATA(r%, c%, maxLen%, city$, sc%)
- LOCATE 9,20: CALL CLREOL: PRINT cityPrompt$ + city$
-
- ' Accept state code
- r% = 11: c% = 20: maxLen% = 2
- CALL PROMPT(r%, c%, statePrompt$, state$, maxLen%, ptype%, rtype%, sc%)
- goodinpt$ = alpha$
- CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
- CALL GETDATA(r%, c%, maxLen%, state$, sc%)
- CALL UPCASE(state$)
- LOCATE 11,20: CALL CLREOL: PRINT statePrompt$ + state$
-
- ' Accept zip code
- r% = 11: c% = 38: maxLen% = 5
- CALL PROMPT(r%, c%, zipPrompt$, zip$, maxLen%, ptype%, rtype%, sc%)
- goodinpt$ = digit$
- CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
- CALL GETDATA(r%, c%, maxLen%, zip$, sc%)
- LOCATE 11,38: CALL CLREOL: PRINT zipPrompt$ + zip$
-
- GOTO Start
-
- REM $INCLUDE : 'P.BAS'
- REM $INCLUDE : 'PROMPT.BAS'
- REM $INCLUDE : 'GETDATA.BAS'
- REM $INCLUDE : 'INPUT.BAS'
-
- END
-
-