home *** CD-ROM | disk | FTP | other *** search
- The file Getfld.tpu is a re-write of the original GETFIELD.
- It is offered AS-IS {meaning that all support is the responsibility
- of the user}. Much help and conversion courtesy of Brian Foley.
-
- Note added 4-22-88 (DAM)
- GetField is used by adding "GetFld" to the USES statement in a Turbo 4
- program. The text of the original documentation follows:
-
- --- GetField Utility ---
- The utility is used to read in a "field" of information at one time. The
- action is similar to a "read" command, except you have the following options:
-
- 1. Conversion to uppercase.
- 2. Field attribute is user specified (what color do you want?)
- 3. Auto-exit if field is filled
- 4. Control-Backspace to erase field and start over.
- 5. Field can be placed anywhere on screen without needing
- to use an additional: GotoXY(Row, Col)
- 6. Automatic check for only certain "Legal" characters, or no checking at
- all!
- 7. Return of scan code for last key read in...
-
- { 8. Full width field, or date file with auto-placement of the '-' characters
- at positions 3 and 6. [Available in MYGET.OBJ only; added 4-15-88;
- Dean Madar] }
-
- To use the utility:
- [ 1. Add the GetFld clause to your USES statement. Turbo Pascal 4 only ].
- 2. Set up variables for each of the following parameters:
- Legal : This variable contains those characters you want to check for
- in the input field. If the string is not a "null" string,
- then those characters you specify will be the only ones that
- will be recognized b the input field. If the string IS
- a "null" or empty string, then no checking on input will
- be performed!
-
- Ibuf : This is where the data will be returned. If it is not empty
- you can specify that the procedure is to display the "old"
- value for editing, etc., or if that option is not chosen,
- this string will automatically be emptied for you!
-
- Atrib : This INTEGER is where you specify what background and
- forground you wish to use. When setting this number,
- I find the following formulat useful:
- Atrib := (Background_Color shl 4) + Foreground_Color;
- { add 128 ($80) if you want to have the field "blink" }
- Background_Color can be any of the "Dark colors" listed in
- the Turbo Manual, and Foreground_Color can be any of the
- colors listed in the manual. For example, the normal
- screen would be: $000F, and a "reverse" video field would
- be "$00070.
-
- Row,Col : These two INTEGER values are the Row (Y position), and
- Column (X position) of where to start the field.
-
- Size : This INTEGER value is the maximum size of the field. This
- number determines the size of the colored field.
-
- Options : This set contains all of the option switches used by this
- routine. At the present time, the switches are:
-
- [] : No options chosen.
- [1] : Convert all alphabetic values to uppercase.
- [2] : Date Field { MYGET.OBJ, only; 4-15-88; Dean Madar }
- [3] : No use defined yet.
- [4] : "
- [5] : Exit from field if field is "full".
- [6] : No use defined yet.
- [7] : Use initial value of Input Buffer (IBuf), otherwise
- blank Ibuf, and start clean.
-
- Notes: For the Date Field option, the Bksp, LtArr and RtArr keys will
- skip the dashes. The Del key will also clear the entire field.
-
- KeyVal : No initial value is needed for this! This variable will
- contain the scan code for the last key pressed. For the
- scan codes, I use the tables in the Turbo Manual (3.01A).
- Insead of returning 2 characters, I return one integer. For
- those keys which are actually an escape-code pair, I take the
- 2nd byte and add 256. For example, the manual states that
- the F1 key is 27 59. I return this as 315. (59 +256).
-
- The routine will exit for a key code of less than 32 ($20), or greater than
- 127 ($7F) is found, except for the following keys:
-
- [Home] = Move cursor to start of field
- [End] = Move cursor to the right of the last character.
- [LeftArrow] = Move cursor left one position
- [RightArrow] = Move cursor right one position
- [BackSpace] = Erase character to left of cursor and move cursor left
- [Del] &
- [^BackSpace] = Clear entire field and start over
-