Dec 092017
 
Replicates dbase command @say in TP4+,also includes other good routines.
File ATSAY5.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Replicates dbase command @say in TP4+,also includes other good routines.
File Name File Size Zip Size Zip Type
ATSAYGET.DOC 6582 2402 deflated
ATSAYGET.TPU 20656 6417 deflated
BLUEBAG.DOC 4303 2032 deflated
BLUEBAG.TPU 11184 4469 deflated
DEMO.PAS 6342 2361 deflated

Download File ATSAY5.ZIP Here

Contents of the ATSAYGET.DOC file


ATSAYGET.DOC for Version 4.1 of ATSAYGET.PAS unit:

The AtSayGet.TPU is a unit of procedures that allows positioning
of data entry prompts and screened data entry. A full range of editing
keys are also employed. These features give the functional equivalence
of the dBase: @ Line,Row SAY 'prompt' GET [PICTURE 'template']
command. The unit interface follows:

UNIT ATSAYGET;
TYPE
Xrange=1..79;
Yrange=1..25;
FieldTxt=STRING[80];

(* BOOLEAN PROCEDURE *)
PROCEDURE AtSayGetBoolean(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR TorF :BOOLEAN); {boolean variable}

(* STRING PROCEDURES *)
PROCEDURE AtSayGetStrLen(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InStr :FieldTxt; {string variable being entered}
FldLen:BYTE); {allowed field length of entry}

PROCEDURE AtSayGetStrPic(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InStr :FieldTxt; {string variable being entered}
Pic :FieldTxt); {picture template
TempletSet=['!','9','A','X'];
! forces uppercase
9 allows only numeric entry
A allows only alpha entry
X allows any entry}
(* NUMERIC PROCEDURES *)
PROCEDURE AtSayGetReal(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InNum :REAL ; {numeric variable being entered}
FldLen, {allowed field length of entry}
DecPl :INTEGER); {decimal places}

PROCEDURE AtSayGetLongInt(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InNum :LONGINT; {numeric variable being entered}
FldLen:INTEGER); {allowed field length of entry}

PROCEDURE AtSayGetInt(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InNum :INTEGER; {numeric variable being entered}
FldLen:INTEGER); {allowed field length of entry}

(* NUMERIC PROCEDURES - Cont. *)
PROCEDURE AtSayGetWord(X :Xrange;
Y :Yrange;
Prompt:FieldTxt; {text of prompt}
VAR InNum :WORD; {numeric variable being entered}
FldLen:INTEGER); {allowed field length of entry}



EDITING KEYS

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

Key(s) Function
-------------- --------------------------------------------------
<-
Ctrl S . . . . Move cursor one character to the left.
->
Ctrl D . . . . Move cursor one character to the right.
Ctrl <-
Ctrl A . . . . Move cursor one word to the left.
Ctrl ->
Ctrl F . . . . Move cursor one word to the right.
Home
Ctrl Z . . . . Move to the start of the field.
End
Ctrl B . . . . Move to the last character in the field.
Del
Ctrl G . . . . Delete the character at the cursor position and
pull over all the characters on the right.
Ctrl T . . . . Delete word to right and pull over remaining text.
Ctrl Y . . . . Delete the whole field.
Ctrl R . . . . Restore field to its original state before edit.
BackSpace . . Delete the character to the left of the cursor and
pull over all the characters on the right.
Ins
Ctrl V . . . . Toggles insert on/off.
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.


SPECIAL CONSIDERATIONS:

Compiler Settings:
Programs using AtSayGet.TPU 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 first
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(InStr).
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 returned as [ 120]. This
is different than the way dBase accepts numeric input (which, in this example,
would return [ 12]) and can be modified in the unit source code if desired.

Screen limits:
Note that the maximum X-coordinate is 80 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]+1) > 80.

Range checking:
Numeric range checking routines are incorporated within the AtSayGet
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 and VALID clauses of dBase are not emulated but this is a simple coding
task that any Pascal programmer can handle.

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

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

This Turbo Pascal unit was compiled with the version 4.0 compiler, and was
coded by John Roncalio, BlueRibbon Software, 34439 Ascott Avenue, Abbotsford,
B.C., CANADA, V2S 4V6. CIS: [72377,1657]

Source code for this unit and the BlueBag unit are available on disk for the
small charge of $8.50 (U.S.) or $10.oo (Canadian). Order by writing to the copyright holder noted above.


 December 9, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)