home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / GETFLD.ZIP / GETFLD.TXT < prev    next >
Encoding:
Text File  |  1988-04-22  |  4.8 KB  |  93 lines

  1. The file Getfld.tpu is a re-write of the original GETFIELD.
  2. It is offered AS-IS {meaning that all support is the responsibility
  3. of the user}. Much help and conversion courtesy of Brian Foley.
  4.  
  5. Note added 4-22-88 (DAM)
  6.    GetField is used by adding "GetFld" to the USES statement in a Turbo 4
  7. program.  The text of the original documentation follows:
  8.  
  9.                      --- GetField Utility ---
  10. The utility is used to read in a "field" of information at one time.  The
  11. action is similar to a "read" command, except you have the following options:
  12.  
  13.   1. Conversion to uppercase.
  14.   2. Field attribute is user specified (what color do you want?)
  15.   3. Auto-exit if field is filled
  16.   4. Control-Backspace to erase field and start over.
  17.   5. Field can be placed anywhere on screen without needing
  18.      to use an additional: GotoXY(Row, Col)
  19.   6. Automatic check for only certain "Legal" characters, or no checking at
  20.      all!
  21.   7. Return of scan code for last key read in...
  22.  
  23. {  8. Full width field, or date file with auto-placement of the '-' characters
  24.      at positions 3 and 6.  [Available in MYGET.OBJ only; added 4-15-88;
  25.      Dean Madar] }
  26.  
  27. To use the utility:
  28. [  1. Add the GetFld clause to your USES statement. Turbo Pascal 4 only ].
  29.   2. Set up variables for each of the following parameters:
  30.         Legal   : This variable contains those characters you want to check for
  31.                   in the input field.  If the string is not a "null" string,
  32.                   then those characters you specify will be the only ones that
  33.                   will be recognized b the input field.  If the string IS
  34.                   a "null" or empty string, then no checking on input will
  35.                   be performed!
  36.  
  37.         Ibuf    : This is where the data will be returned.  If it is not empty
  38.                   you can specify that the procedure is to display the "old"
  39.                   value for editing, etc., or if that option is not chosen,
  40.                   this string will automatically be emptied for you!
  41.  
  42.         Atrib   : This INTEGER is where you specify what background and
  43.                   forground you wish to use.  When setting this number,
  44.                   I find the following formulat useful:
  45.                     Atrib := (Background_Color shl 4) + Foreground_Color;
  46.                     { add 128 ($80) if you want to have the field "blink" }
  47.                   Background_Color can be any of the "Dark colors" listed in
  48.                   the Turbo Manual, and Foreground_Color can be any of the
  49.                   colors listed in the manual.  For example, the normal
  50.                   screen would be: $000F, and a "reverse" video field would
  51.                   be "$00070.
  52.  
  53.         Row,Col : These two INTEGER values are the Row (Y position), and
  54.                   Column (X position) of where to start the field.
  55.  
  56.         Size    : This INTEGER value is the maximum size of the field.  This
  57.                   number determines the size of the colored field.
  58.  
  59.         Options : This set contains all of the option switches used by this
  60.                   routine. At the present time, the switches are:
  61.  
  62.                   []  : No options chosen.
  63.                   [1] : Convert all alphabetic values to uppercase.
  64.                   [2] : Date Field { MYGET.OBJ, only; 4-15-88; Dean Madar }
  65.                   [3] : No use defined yet.
  66.                   [4] :      "
  67.                   [5] : Exit from field if field is "full".
  68.                   [6] : No use defined yet.
  69.                   [7] : Use initial value of Input Buffer (IBuf), otherwise
  70.                         blank Ibuf, and start clean.
  71.  
  72.         Notes:  For the Date Field option, the Bksp, LtArr and RtArr keys will
  73.                 skip the dashes.  The Del key will also clear the entire field.
  74.  
  75.         KeyVal  : No initial value is needed for this!  This variable will
  76.                   contain the scan code for the last key pressed.  For the
  77.                   scan codes, I use the tables in the Turbo Manual (3.01A).
  78.                   Insead of returning 2 characters, I return one integer.  For
  79.                   those keys which are actually an escape-code pair, I take the
  80.                   2nd byte and add 256.  For example, the manual states that
  81.                   the F1 key is 27 59.  I return this as 315. (59 +256).
  82.  
  83.    The routine will exit for a key code of less than 32 ($20), or greater than
  84.    127 ($7F) is found, except for the following keys:
  85.  
  86.          [Home] = Move cursor to start of field
  87.           [End] = Move cursor to the right of the last character.
  88.     [LeftArrow] = Move cursor left one position
  89.    [RightArrow] = Move cursor right one position
  90.     [BackSpace] = Erase character to left of cursor and move cursor left
  91.        [Del]  &
  92.    [^BackSpace] = Clear entire field and start over
  93.