Dec 082017
 
Utility which allows full screen editing of data entry screens. Turbo Pascal source code available to registered users.
File ASG53.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Utility which allows full screen editing of data entry screens. Turbo Pascal source code available to registered users.
File Name File Size Zip Size Zip Type
ATSAYGET.DOC 14427 4469 deflated
ATSAYGET.TPU 26320 10046 deflated
BLUEBAG.DOC 10199 4023 deflated
BLUEBAG.TPU 19744 7513 deflated
DEMO.PAS 14262 5147 deflated
R2ENGLSH.INC 3226 1459 deflated
RASGDEMO.INC 2065 878 deflated
READASG.DOC 7274 1959 deflated
READASG.TPU 16960 6650 deflated
READDEMO.DAT 285 220 deflated

Download File ASG53.ZIP Here

Contents of the ATSAYGET.DOC file


Documentation for Version 5.3 of the ATSAYGET unit:

The new AtSayGet procedures are built around a powerful LINE EDITOR with
WordStar (c) compatibility. These features give the functional equivalence
of the dBase (c) @ Line,Row SAY 'prompt' GET [PICTURE] [RANGE] command.

Version 5.3 is smaller, offers a new procedure, insludes an new template code
in the PICTURE clause, and fixes a few minor bugs. As with the previous
version the line editing keys hook into the FULL SCREEN EDITOR available in
the included ReadASG unit.

The AtSayGet unit interface follows:

UNIT ATSAYGET;

INTERFACE

USES
DOS,
BlueBag;

TYPE
MaxFL = 1..20; {Data field length range for numeric procedures}
FieldTxt = STRING[78];

CONST
{ASG exit codes; Inspect ASGExit to see how the procedure exited.}
Aborted = -1; {ASG proc would not fit in window. Procedure aborted.}
Undefined = 0; {you should never get this exit code}
Tab = 9; {TAB key was pressed}
Entered = 13; {ENTER was pressed or the field filled by the operator}
ShTab = 15; {SHIFT TAB keys were pressed}
Escaped = 27; {ESC key was pressed}
Up = 72; {UP key or ^E was pressed}
Down = 80; {DOWN key or ^X was pressed}
ASGExit : INTEGER = Undefined;
SpaceBarOK: BOOLEAN = True; { Space bar (dis)allowed in numeric procedures}

VAR { The following 4 globals are automatically set to appropriate
values but may be modified in your code. EG: SayAttr:=79 will
display the prompt as white on red, and GetAttr:=65 will dis-
play the entry field as blue on red (or underlined on a mono
screen) }
OrgAttr { Text attribute before entering (and after exiting) an ASG proc}
SayAttr, { Text attribute of prompt }
GetAttr, { Text attribute of entry field during editing }
EndAttr, { Text attribute of entry field after exiting }
: BYTE;

(* BOOLEAN PROCEDURE *)

PROCEDURE
AtSayGetBoolean(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetB :BOOLEAN); {Boolean variable;
See comments at end of doc}

(* CHARACTOR PROCEDURE *)

PROCEDURE
AtSayGetCharPic(X :Xrange ;
Y :Yrange ;
Prompt:FieldTxt; {text of prompt}
VAR GetC :CHAR ; {charactor variable}
Pic :CHAR ); {(see comments on Pic in
AtSayGetStrPic below)}

(* STRING PROCEDURES *)

PROCEDURE
AtSayGetStrLen(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetStr:FieldTxt; {string variable being entered}
Len :BYTE ); {allowed field length of entry}

PROCEDURE
AtSayGetStrPic(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt ; {text of prompt}
VAR GetStr:FieldTxt ; {string variable being entered}
Pic :FieldTxt); {picture template}

{Special PICture charactors:
! converts letters to uppercase
# restricts entry to numbers, spaces, signs
9 restricts entry to numbers and signs
A restricts entry to alphabetic charactors
a converts letters to lower case (* NEW W/VER 5.3 *)
N restricts entry to letters and numbers
X allows any charactor}


(* NUMERIC PROCEDURES *)

PROCEDURE { NEW TO VERSION 5.3 }
AtSayGetByte(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetB :BYTE ; {BYTE numeric variable being entered}
FldLen:MaxFL ); {Length of entry field. (FldLen>3 is useless)}

PROCEDURE
AtSayGetReal(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetR :REAL ; {Real numeric variable being entered}
FldLen:MaxFL ; {Length of entry field}
DecPl :INTEGER); {decimal places}

PROCEDURE
AtSayGetLongInt(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetLI :LONGINT ; {LongInt numeric variable being entered}
FldLen:MaxFL ); {Length of entry field (FldLen>10 is useless)}

PROCEDURE
AtSayGetInt(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetInt:INTEGER ; {Integer numeric variable being entered}
FldLen:MaxFL ); {Length of entry field. (FldLen>6 is useless)}

PROCEDURE
AtSayGetWord(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetW :WORD ; {Word numeric variable being entered}
FldLen:MaxFL ); {Length of entry field. (FldLen>5 is useless)}



The AtSayGetRange procedures shell around the AtSayGet numeric procedures
(which are but shells around the AtSayGetStrPic string procedure). Using
the AtSayGetRange procedures let you to specify a minimum and maximum
allowable range of input. There are 4 Range procedures which all follow the
syntax of their corresponding ASG numeric procedures except that they re-
quire two additional parameters: the first is the Minimum allowed range and
the 2nd is the Maximum allowed range.

PROCEDURE
AtSayGetRealRange(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetR :REAL ; {numeric variable being entered}
FldLen, {allowed field length of entry}
DecPl :MacFL ; {decimal places}
Min, {minimum acceptable value}
Max :REAL ); {maximum acceptable value}

PROCEDURE
AtSayGetLongIntRange(AtX :Xrange ; {X coordinate}
AtY :Yrange ; {Y coordinate}
Say :FieldTxt; {text of prompt}
VAR GetLI :LONGINT ; {numeric variable being entered}
FldLen:MaxFL ; {allowed field length of entry}
Min, {minimum acceptable value}
Max :LONGINT); {maximum acceptable value}

PROCEDURE
AtSayGetIntRange(X :Xrange ; {X coordinate}
Y :Yrange ; {Y coordinate}
Prompt:FieldTxt; {text of prompt}
VAR GetI :INTEGER ; {numeric variable being entered}
FldLen:MaxFL ; {allowed field length of entry}
Min, {minimum acceptable value}
Max :INTEGER); {minimum acceptable value}

PROCEDURE
AtSayGetWordRange(X :Xrange ; {X coordinate}
Y :Yrange ; {Y coordinate}
Prompt:FieldTxt; {text of prompt}
VAR GetW :WORD ; {numeric variable being entered}
FldLen:MaxFL ; {allowed field length of entry}
Min, {minimum acceptable value}
Max :WORD ); {minimum acceptable value}

Finally, the simple AtSay procedure used by all of the above has been in-
terfaced. If you are using the procedures in this unit you might as well use
AtSay rather than GoToXY(x,y); WRITE('Something to say');

PROCEDURE AtSay(X :Xrange ;
Y :Yrange ;
Prompt:FieldTxt); {Prompt is displayed according to SayAttr}

EDITING KEYS

When you are positioned in a data field certain keys and combinations
of keys will facilitate editing. If the operator is familiar with dBase or
WordStar (s)he will find that the editing keys noted below are very similar.

Key(s) Function ASGExit
-------------- -------------------------------------------------- -------
<-, ^S . . . Move cursor one character to the left. 0
->, ^D . . . Move cursor one character to the right. 0
^ <-, ^A . . . Move cursor one word to the left. 0
^ ->, ^F . . . Move cursor one word to the right. 0
Home, ^Z . . . Move to the start of the field. 0
End, ^B . . . Move to the last character in the field. 0
Del, ^G . . . Delete the character at the cursor position and
pull over all the characters on the right. 0
^T . . . . . . Delete word to right and pull over remaining text. 0
^Y . . . . . . Delete the whole field. 0
^R . . . . . . Restore field to its original state before edit. 0
BackSpace . . Delete the character to the left of the cursor and
pull over all the characters on the right. 0
Ins, ^V . . . Toggles insert on/off. Block cursor for insert mode. 0
SpaceBar . . . Move cursor to the right. If insert is off it will
over-write any characters, otherwise it will push them
to the right as it moves. 0
Tab . . . . . Accepts the field and exits if the entry is valid. 9
Enter . . . . " " " " " " " " " " 13
Shift Tab . . " " " " " " " " " " 15
Esc . . . . . Exits procedure abandoning any edits that were made 27
UP, ^E . . . Accepts the field and exits if the entry is valid. 72
DOWN, ^X . . . " " " " " " " " " " 80

SPECIAL CONSIDERATIONS:

Compiler Settings:
Programs using the AtSayGet or ASGRange units must be compiled with the
Options/Compiler/Var-string checking as RELAXED, or include the {$V-}
compiler directive.

Initialization of variables:
All formal variable parameters passed to one of the AtSayGet pro-
cedures should first be properly initialized as the current value of the
variable will be displayed in the data field. For example, if you are using
the AtSayGetStrLen procedure to enter a new STRING[10] variable without 1st
properly initializing the variable with an actual or nul value, 10 "random"
charactors will be displayed in the entry field until a ^Y is issued or the
field is filled with data by the operator.
Special care must taken with variables passed to the AtSayGetStrPic
procedure to initialize the formal variable with the exact length of spaces
or text equal to SizeOf(GetStr).
When using an AtSayGet procedure to enter numeric data you will also
wish to initialize the variable. All numerals in the entry field, even if
they are seperated with spaces, will compose the value passed by the
procedure. Thus, in a field the length of 4 the entry [12_0] will be re-
turned as [ 120]. This is different than the way dBase accepts numeric input
(which, in this example, would return [ 12] ).

Screen considerations:
Unlike some other line editors the prompts in these AtSayGet procedures
are positioned on the screen in the normal Pascal X,Y (column,row) format.
The dBase style Y,X (row,column) positioning is fine for dBase programmers
but we use Pascal and should maintain consistency in conventions.
All of the AtSayGet procedures work equally well on either a mono or
color display. With a color display the procedures automatically adapt to
the background color and display the prompt and field in an appropriate
color. The default colors c/b altered by changing the global variables
SayAttr & GetAttr.
The AtSayGet string procedures indicate insert mode with a block cursor
and overwrite mode with a normal cursor. Upon exit the cursor is set to the
default state for the type of monitor being used. Thus, if you have entered
an AtSayGet procedure with a modified cursor and you want it the same after
exit ing, you will have to re-modify the cursor in your subsequent code.
Note that the maximum X-coordinate is 79 and the maximum Y-coordinate
is 25. Nevertheless, these procedures will not wrap on the screen, but
rather will just exit without doing anything if (X+Length(Prompt)+[field
length]) > 80. Likewise, when an AtSayGet procedure is used in a window
that is narrower than 80 the procedure will exit without running if it
would otherwise wrap in the window. In either case ASGExit is set to
Aborted (-1).
Finally, you can not USE any of these units with TurboPower's TPCRT
unit because they USE CRT. You may change the USEs to TPCRT and recompile
these units if you wish to use TPCRT, but, of course, source code is re-
quired. Source code of the latest version will be sent to all registered
users.

Range checking:
Numeric range checking routines are incorporated within the AtSayGet
numeric procedures. Thus, if the operator enters a negative number in a
AtSayGetWord field the bell will ring and the message ERROR will be briefly
displayed.
The RANGE clause of dBase was emulated by writing a shell around the
AtSayGet numeric procedures. With an AtSayGetRange procedure an entry that
is too small will sound the bell, briefly fill the field with <<<<<<<...,
and reset the field to the minimum allowed range. If the entry is too large
the bell sounds, the field is briefly filled with >>>>>>>..., and the field
reset to the maximum allowed value. The procedure will not exit until a valid
range is entered. If you program an illogical range (EG: 70000,-5 in the
AtSayGetWordRange procedure) a compiler range error or run-time range error
will be generated.

Valid AtSayGetBoolean enteries:
Affirmative entries are: '+','t','T','y','Y'
Negative entries are: '-','f','F','n','N'

Demonstration of procedures:
Compile and run DEMO.PAS to see how the procedures in this unit can
be used. When looking at the code notice how the variables are initialized.

* * * * * * * * * * * * * * * * * * * * * * * * *




 December 8, 2017  Add comments

Leave a Reply