home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / ACCEPT.ZIP / ACPTDEMO.BAS < prev    next >
Encoding:
BASIC Source File  |  1987-08-02  |  4.0 KB  |  118 lines

  1. '  ACPTDEMO.BAS
  2. '       This is a demo of the accept at routines.  The following source
  3. '       programs must be on your disk prior to compiling the demo:
  4. '       PROMPT.BAS, P.BAS, GETDATA.BAS, and INPUT.BAS.
  5. '
  6. '       You must also designate the ADVBAS library (ADVBAS v3.4) when
  7. '       loading QuickBASIC: qb /l ADVBAS.EXE or qb87 /ADVBAS.EXE.
  8. '
  9. '       The ACCEPTAT routines run under QB v 3.0 only.
  10. '
  11. '       This program was written for a MONOCHROME monitor and revisions
  12. '       might be necessary for COLOR monitors in the attribute definitions
  13. '       found in the PROMPT subprogram.
  14. '
  15. COMMON SHARED  true%, false%
  16.  
  17. ' Initialize
  18.     true% = -1: false% = 0
  19.  
  20. ' Set up any desired strings to designate valid input.
  21.     ualpha$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  22.     lalpha$ = "abcdefghijklmnopqrstuvwxyz"
  23.     alpha$ = ualpha$ + lalpha$
  24.     digit$ = "0123456789"
  25.     numeric$ = digit$ + ".+-E"
  26.     punctuation$ = ".,':;?/()&#* "
  27.  
  28. ' Set up the field prompts to be used
  29.     namePrompt$    = " Customer Name: "
  30.     streetPrompt$  = "Street Address: "
  31.     cityPrompt$    = "          City: "
  32.     statePrompt$   = "         State: "
  33.     zipPrompt$     = "      Zip Code: "
  34.  
  35. ' The following represents an existing set of data
  36.     name$     = "Doggie Biscuits, Inc."  'max 25 chars
  37.     street$   = "3345 Industrial Pky."   'max 25 chars
  38.     city$     = "DuBuque"                'max 25 chars
  39.     state$    = "IA"                     'max 2 chars
  40.     zip$      = "52001"                  'max 5 chars
  41.  
  42. ' Display the prompts and existing data
  43.     LOCATE 5, 20: PRINT namePrompt$ + name$
  44.     LOCATE 7, 20: PRINT streetPrompt$ + street$
  45.     LOCATE 9, 20: PRINT cityPrompt$ + city$
  46.     LOCATE 11,20: PRINT statePrompt$ + state$
  47.     LOCATE 11,40: PRINT zipPrompt$ + zip$
  48.  
  49. ' Display control key functions
  50.     LOCATE 14,10
  51.     PRINT STRING$(60,205)
  52.     LOCATE 16,10
  53.     PRINT "Ins - toggels insert mode      Del  - deletes a character"
  54.     LOCATE 18,10
  55.     PRINT "Esc - restores original data   BkSp - destructive backspace"
  56.     LOCATE 20,10
  57.     PRINT " ";CHR$(27);" - moves left";TAB(41);CHR$(26);" - moves right"
  58.     LOCATE 22,25
  59.     PRINT "Press ENTER to accept data"
  60.     LOCATE 24,25
  61.     PRINT "To Stop Press CONTROL BREAK";
  62. Start:
  63.  
  64. ' Accept customer name
  65.     ptype% = 2 'make prompt high intensity
  66.     rtype% = 3 'make response reverse video
  67.     sc% = 176  'use CHR$(176) to fill extra response positions
  68.     r% = 5: c% = 20: maxLen% = 25
  69.     CALL PROMPT(r%, c%, namePrompt$, name$, maxLen%, ptype%, rtype%, sc%)
  70.     ' Note: r% and c% are left pointing to first response byte
  71.     goodinpt$ = alpha$ + digit$ + punctuation$
  72.     CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
  73.     CALL GETDATA(r%, c%, maxLen%, name$, sc%)
  74.     LOCATE 5,20: CALL CLREOL: PRINT namePrompt$ + name$
  75.  
  76. ' Accept street address
  77.     r% = 7: c% = 20: maxLen% = 25
  78.     CALL PROMPT(r%, c%, streetPrompt$, street$, maxLen%, ptype%, rtype%, sc%)
  79.     goodinpt$ = alpha$ + digit$ + punctuation$
  80.     CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
  81.     CALL GETDATA(r%, c%, maxLen%, street$, sc%)
  82.     LOCATE 7,20: CALL CLREOL: PRINT streetPrompt$ + street$
  83.  
  84. ' Accept city
  85.     r% = 9: c% = 20: maxLen% = 25
  86.     CALL PROMPT(r%, c%, cityPrompt$, city$, maxLen%, ptype%, rtype%, sc%)
  87.     goodinpt$ = alpha$ + punctuation$
  88.     CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
  89.     CALL GETDATA(r%, c%, maxLen%, city$, sc%)
  90.     LOCATE 9,20: CALL CLREOL: PRINT cityPrompt$ + city$
  91.  
  92. ' Accept state code
  93.     r% = 11: c% = 20: maxLen% = 2
  94.     CALL PROMPT(r%, c%, statePrompt$, state$, maxLen%, ptype%, rtype%, sc%)
  95.     goodinpt$ = alpha$
  96.     CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
  97.     CALL GETDATA(r%, c%, maxLen%, state$, sc%)
  98.     CALL UPCASE(state$)
  99.     LOCATE 11,20: CALL CLREOL: PRINT statePrompt$ + state$
  100.  
  101. ' Accept zip code
  102.     r% = 11: c% = 38: maxLen% = 5
  103.     CALL PROMPT(r%, c%, zipPrompt$, zip$, maxLen%, ptype%, rtype%, sc%)
  104.     goodinpt$ = digit$
  105.     CALL INPT(r%, c%, rtype%, maxLen%, goodinpt$, sc%)
  106.     CALL GETDATA(r%, c%, maxLen%, zip$, sc%)
  107.     LOCATE 11,38: CALL CLREOL: PRINT zipPrompt$ + zip$
  108.  
  109. GOTO Start
  110.  
  111. REM $INCLUDE : 'P.BAS'
  112. REM $INCLUDE : 'PROMPT.BAS'
  113. REM $INCLUDE : 'GETDATA.BAS'
  114. REM $INCLUDE : 'INPUT.BAS'
  115.  
  116. END
  117.  
  118.