home *** CD-ROM | disk | FTP | other *** search
- INFIELD USER'S GUIDE
-
- Version 2.0
- February 10, 1989
-
-
- _______
- ____|__ | (tm)
- --| | |-------------------
- Menne Computers | ____|__ | Association of
- W277 S4455 Elk Valley Court | | |_| Shareware
- Waukesha, WI 53188-6437 |__| o | Professionals
- -----| | |---------------------
- |___|___| MEMBER
-
-
- This general data input routine is written in Turbo Pascal version 5.0.
- Below is the interface section of the unit. The unit is designed to work with
- QWIK42B.TPU, compiled under TP5.
- ------------------------------------------------------------------------------
- Unit InField;
-
- Interface
- Uses Crt, Qwik;
-
- type Strng80 = string[80];
-
- var SOE, COE, EOB, { Abbreviations mean: }
- EOA, ISnd, Kclk, { Strip On Exit, SOE }
- ESTP, HomEnd, { Clear On Entry, COE }
- UseTemp, Keeptemp, { ESC On Blank, EOB }
- CapsOnly, MOK, { Exit on Arrow (up or down) key EOA }
- LfRt, Flush, { Sound, Isnd }
- IExit : boolean; { Keyclick, Kclk }
- { Strip off end spaces ESTP }
- { Cursor placement when called HomEnd }
- { Use a Template UseTemp }
- { Keep Template in rtn string KeepTemp }
- { All letters capitalized CapsOnly }
- { Move cursor on key in template MOK }
- { Exit on Arrow (left or right) LfRt }
- { Flush Left (false) or right Flush }
- { Global exit flag IExit }
- FKey, TAttr : integer; { Function key number, Fkey }
- { Template attribute, TAttr }
- StCh, EnCh : char; { Starting and ending character. }
- Template : Strng80; { Template string }
-
-
-
- procedure Data_In(Drow, Dcol, MaxWide : integer;
- Var InWord : Strng80;
- Dattr : integer);
-
- procedure BadChoice;
- procedure Strip(Var Stripit : String);
- function StrOf(Count, Ascii : byte ) : String;
- function Strcmp(Astr1, Astr2 : String) : shortint;
-
-
-
- Implementation
- -----------------------------------------------------------------
-
- This is a general data input unit that far outperforms the rest, yet is
- much smaller that others I have seen (only 7k). The basic screen output is
- handled by Eagle Performance Software's excellent Qwik routines. (QWIK42B.ARC
- - You bet I registered!) You set the starting row and column (Beware of
- setting DRow to X and DCol to Y, the normal order for GotoXY. If you don't
- like this, register the LeMay Qwik utility and use GotoRC like I do!), the
- maximum width of the field (this has no effect when you use templates), the
- string to edit and the color of the field. Here is a run down of the various
- other features:
-
- EDITING - It acts like a mini-wordprocessor on a line! You toggle insert
- mode with Ins, and the cursor will get larger in insert mode and
- smaller in overwrite. The cursor is restored to what it was on
- exit. Word right and Word left (Ctrl-arrows) works, and
- PgDn=End=Ctrl-PgDn=Ctrl-End, as well as
- PgUp=Home=Ctrl-PgUp=Ctrl-Home. Del and BackSpace are implemented,
- but Tab has no effect.
-
- SOUND - Can be turned on and off through ISnd. You can also enable a
- keyclick with the Kclk variable. Sound is output when an invalid
- key is pressed, or when you are at the end of the data field, or
- when you press ESC. The global procedure BadChoice is the procedure
- that makes the sound when you press an invalid key.
-
- CLEAR ON ENTRY - if you want the text to be initialized with spaces when
- entering the routine, then set COE to TRUE. Otherwise, the
- current string is displayed in the field, and pressing
- Return will accept that string.
-
- STRIP ON EXIT - If you want to get rid of all spaces and nulls after the text
- is input, set SOE to TRUE, otherwise the string will be left
- alone. The global procedure Strip does the stripping.
-
- END STRIP - This strips off all trailing spaces on exit. This works
- independently from the other strip functions. There is no
- procedure available to the user to do this, mainly because of
- variable constraints.
-
-
- COLORS - the attribute byte, Dattr, specifies the main text color. The
- global variable, Tattr, specifies the template attribute. Both of
- these variables are set by the following equation:
- Attr := (background shl 4) + foreground;
- Using Turbo Pascal's color constants is even more friendly:
- Attr := (Blue shl 4) + White;
- You can also specify what the characters at the beginning and end
- of the field are through StCh and EnCh. StCh refers to the
- starting character. EnCh refers to the ending character. To disable
- having a starting and/or an ending character, set StCh and/or EnCh to
- 'N'. By the way, if Tattr <> 255, then StCh and EnCh will be ouput
- using Tattr, the template attribute. Otherwise, they will use the
- normal text color (Tattr = 255, the default). This is done so that
- you won't have to change Tattr every time you change colors in your
- program.
-
- CAPSONLY - Forces all characters input to be upper case.
-
- LEFT & RIGHT ARROW EXIT - In most cases, you simply wish the up and down
- arrows to exit, not the left and right arrows,
- which are useful for editing. If you wish to
- exit on the left and right arrow, then set
- LfRt to TRUE. The default is FALSE.
-
- FLUSH LEFT OR RIGHT - This variable controls whether to flush the give
- string in InWord left or right in the field (moot
- point if you've set Clear on Entry to TRUE). If
- Flush = false, then the data will be left justified,
- else the data will be right justified.
-
- HOME OR END CURSOR - This variable causes the cursor to be placed at the
- beginning of the data or the end of the data. If it
- is TRUE, the cursor will be put to the beginning of
- the data. If FALSE, it will be put at the end. The
- default is FALSE.
-
- TEMPLATES - You can specify a template around which text will be entered.
- For instance, " / / " can be used for dates " . "
- can be used for file names, etc. When you enter text, the text
- "flows" around the characters in the template. The template is
- specified by setting the global string variable, Template, to
- what you want.
- To use the template, set the global variable UseTemp to TRUE.
- You also have the option of leaving the template in the inputted
- text. This is set through the KeepTemp variable. For example,
- with KeepTemp FALSE, and a template of " / / ", if you input
- "06/04/88", the result in InWord is "060488". But if you set
- KeepTemp to TRUE, the result will be "06/04/88".
- A further option with templates is the Move On Key feature.
- When MOK is TRUE, and the user presses a character that is TO
- THE RIGHT of the cursor position, the cursor position will move
- to one space after the character in the template. To explain,
- say you have a template " . ", and the screen looks
- like this:
- "INTEST▄ . "
- and the user presses the "." key. The screen will then look
- like this:
- "INTEST .▄ "
- It doesn't matter how many of the same characters you have in
- the field, either. For instance, if the screen looked like this:
- "AK005-7721-31 -41▄ - - "
- and the user presses the "-" key, the screen will look like this:
- "AK005-7721-31 -41 -▄ - "
- When MOK is false, of course, none of this happens.
-
- PROGRAMMING - Say you want pop up help from this field? Say you have
- several fields and you want to cursor through them? Infield
- handles these problems, too. Any regular, shifted,
- controlled, or alted (alted?) function key will set the global
- exit flag, Iexit, to TRUE, and the key number will be left in
- FKey. By the way, the key number for the last key pressed
- before exiting is ALWAYS left in Fkey. See the reference
- section of the Turbo Pascal manual for the key numbers. If
- you want to exit on any cursor key, set EOA to TRUE. This
- workes for Up, Down, Left and Right arrow keys, so the Right
- and Left arrow keys are no longer available for editing. This
- is when the EOA flag comes into play, also. If you wish to
- check if the user pressed return on an empty field, set EOA to
- TRUE. Then, if they do that, the global exit flag Iexit will
- be set to TRUE. Fkey will contain 13, the key number for
- Return.
-
-
- INCLUDED ROUTINES - There are several lightning quick machine language
- routines which I have included. Strip allows you
- to remove all whitespace characters from a string,
- including char #32, #00, and #255. It does NOT
- remove anything else (such as #13, #10, etc.). StrOf
- returns a string that is Count characters long, containing
- the ASCII character specified by Ascii. Strcmp is an
- extremely fast string comparison routine which returns a
- 0 if the two strings are equal, a -1 if Astr1 is less than
- Astr2, and a 1 if Astr1 is greater than Astr2. BadChoice
- makes a sound to indicate an error.
-
-
- DEFAULTS:
- Iexit := false;
- SOE := false;
- COE := false;
- EOB := false;
- EOA := false;
- ISnd := true;
- Kclk := false;
- UseTemp := false;
- Fkey := 0;
- StCh := '[';
- EnCh := ']';
- KeepTemp := false;
- Template := '';
- TAttr := 255; { A change from last time. }
- MOK := false;
- CapsOnly := false;
- ESTP := true;
- LfRt := false;
- Flush := false;
- HomEnd := false;
-
-
- If you like this unit and use it, please donate $10 to my college education.
- Even just a letter that reports a bug is GREATLY appreciated. If you send
- anything at all, you would reap several benefits. Not only would feel great
- for supporting the Shareware concept, you will have one up on your computer
- friends ("When was the last time YOU registered for a piece of Shareware
- software?" etc.) Send to:
-
- Menne Computers
- Kevin Menningen
- W277 S4455 Elk Valley Ct.
- Waukesha, WI 53188-6437
-
- I have an account on Exec-PC BBS, (414) 964-5160, the LARGEST BBS in the
- world. 75+ lines (I can never remember how many), 1.31+ gigibyte hard disk
- and PC SIG CD-ROM. This is a pay system (only $60 for an 4 meg/week for a
- year), so you cannot leave mail to me unless you have an account. However,
- feel free to check it out through Telenet Direct Connect, PC Pursit or the
- normal telephone network.
-
-
-