home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
popcalc7.zip
/
POPCALC7.DOC
next >
Wrap
Text File
|
1990-12-19
|
13KB
|
247 lines
************************************
* < PopCalc7 > *
* Pop-up Calculator for dBase IV *
* Version 1.1 *
************************************
December 19, 1990
PopCalc7
Pop-Up Calculator
for
dBASE IV / Version 1.1
I don't know about your desk, but more often than not, I barely have enough
room for my coffee cup, much less (ugh!) a calculator. A sizable portion of
the available real estate in front of me has been occupied by PC components for
some time now, and with it, a number of TSRs that tend to make life easier. As
much as I enjoyed version 1.0 (YES! I really got a kick out of it - bugs and
all!), I found that TSRs and dBASE were not to be. Memory was at a premium,
and so was my desk space; and I can't live without at least a rudimentary
calculator at hand. Well, as the saying goes: "Necessity is the Mother of
Invention" (no offense, Frank). With dBASE IV's powerful programming
environment and windowing capabilities, I thought "why not?". The result was
PopCalc.
PopCalc7 operates for all intents and purposes the same as most other
multi-function calculators do. You can store, retrieve, and manipulate a value
held in "memory", and you can even view (and print) a tape filled with your
calculating activity. The ENTER key is the same as the "=" key. To
exponentiate a number, press the carat "^", followed by a number. A paste
function (store a number to a key) is provided along with an immediate paste
routine.
Now that dBASE IV version 1.1 has been released, accompanied by both
additions to the language and its removal of previously imposed ON KEY and
UDF() restrictions, I have added a few new features and routines to PopCalc.
For continuity's sake, this version is known as PopCalc7. The new features
implemented in PopCalc7 include movable and exploding windows, assorted
shadowing techniques, an immediate paste feature, a user-implemented,
on-the-fly re-configuration screen, and the ability to execute from any
application with little or no modification.
All input is now via INKEY(0) exclusively, thereby eliminating any problems
with nested reads when in a multi-page format. Also included is an on-line
help facility <F1> and a UDF() which cleans up the paste number (now stripped
of any leading/trailing blanks, zeros, and decimal points - no more beeps when
pasting an integer to an integer memvar). PopCalc7 now utilizes a memory file
and one public memvar <gl_PopCalc> for retaining its status. The calculator
will save to and restore from the memory file as long as the public memvar
exists, and releases all memory used (except the one public memvar) between
calls to PopCalc7, thereby giving it the appearance of a TSR. The memory
variables which will be saved to PopCalc7.MEM are designated as
m<type>_<name>. ie:
ml_<name> = logical memvars
mn_<name> = numerical memvars
mc_<name> = character memvars
ma_<name> = array memvars
Prior to terminating, this command is issued:
SAVE TO PopCalc7 ALL LIKE m?_*
For you conservative typists (I prefer one key press over many), I suggest
assigning, preferably from within your CONFIG.DB file, a function key to run
PopCalc7 from the dot prompt:
SET FUNCTION <nn> TO "DO PopCalc7;"
To execute it from within a program, one may enable it by a "hot-key"
command such as:
ON KEY LABEL ALT-C DO PopCalc7
Pressing "R" allows one to re-configure PopCalc7, allowing the user to
change four "configuration" memvars from within PopCalc7.
ml_Shadow = .t. for shadow usage
ml_Explode = .t. for exploding windows
ml_Move = .t. enables moving windows.
mn_TapeSiz = Used to declare the tape array.
The logical memvars can be toggled by pressing the space bar, "Y", or "N",
and the tape size array can be adjusted by pressing + or -. The window
appears and acts as though it were painted by:
@..GET..READ...PICTURE "!M Yes, No "
However, it is done entirely with ARRAY, DO WHILE, INKEY(0), and DO CASE
statements. Procedure PC_Param calls Procedure ParamNum to increment/decrement
the user key press for tape size. Additionally, if F1 is pressed, it will call
Procedure CalcHelp.
Pressing "T" enables the tape functions. Control branches to procedure
TapeDisp, where the user can view, print, or clear the tape. The window
PopTape will be activated and can display up to 10 lines at a time. If the
tape consists of more than 10 lines, the last 10 items will be displayed. The
relative position of the current tape screen is indicated by "More" on either
or both of the upper and lower boundaries on the activated tape display. The
user may browse through all tape entries by pressing the up or down arrows for
single line scrolling, <PageUp> or <PageDown> to scroll 10 lines at a time,
<Home> for the beginning, <End> for the end of tape, and F1 for help.
To print the tape, the user may press the "P" key from within the tape
window, and a complete tape listing will be routed to the current printer. The
tape can also be cleared by pressing the "C" key from within the tape window.
Clearing the tape is accomplished by executing procedure TapeInit.
A press of the "P" key from within the calculator executes procedure
PasteVal, allowing one to "paste" the answer to a function key. The user will
then be prompted to enter the function key assignment. The available
assignments are any valid function key from the following table:
F2 thru F10
Shift-F1 thru Shift-F9
Ctrl-F1 thru Ctrl-F10
PopCalc7 will then assign the value held in ANSWER to the key assignment.
PopCalc7 issues the command:
SET <function_key_assignment> TO <value_held_in_ANSWER>
NOTE: When using the paste function within programs, it
is a good idea to let your users know which func-
tion keys are available for use with the paste
function. In order for the paste function to work,
the program MUST NOT have previously assigned ON
KEY LABEL <your_function_paste_key> <command>.
Pressing "E" erases the current entry, while "C" clears entry, operator,
and operand. The OTHERWISE clause is instigated as a catch-all, and resets the
only critical memvar to it's previous value.
*** WHY THE DIFFERENT SHADOWING METHODS? ***
If a window is to be moved, its shadow should be moved also. However,
dBASE IV does not directly offer a shadowed window. A transparant shadow can
be created by @..FILL TO..COLOR W/N. An opaque shadow can take the form of a
second window. Both of these methods require their screen co-ordinates to be an
offset of the window for which they provide the shadow.
Consideration must be given to the screen's status when using shadows. With
a transparent shadow (FILL TO) the screen must first be activated. To
interactively move a window, issue a MOVE WINDOW command. However, there is a
screen refresh between the moves, and when using a trans- parent shadow, the
shadow is lost. One can program around this annoying behavior by merely
activating the screen after the move window, issue a couple of FILL TOs to
provide a two sided shadow, and then ACTIVATE the moved WINDOW. This way, the
contents of the window are saved (never had to deactivate the window), the old
shadow has disappeared, and a new shadow is created. Using this method allows
the characters under the shadow to be viewed, however, it requires extensive
programming to achieve transparent shadows when more than one window is veiwed
and all are subject to movement. This can really slow down an application when
one is deeply nested, and when operating slowly, can cause an annoying blink of
the shaded areas.
An easy way of moving windows with shadows is to use the opaque variety (a
window as a shadow) and issue the MOVE WINDOW command first to the shadow
window, and then to the primary window. The commands are simple and the motion
is relatively smooth. Procedure Move_Win illustrates this.
If one disables window movement for PopCalc7, the shadows, if enabled, will
be transparent; otherwise, opaque.
*** NAVIGATIONAL KEYS AND THEIR RELATIONS ***
Movement of the calculator or tape window is accomplished by pressing the
arrow keys, page, or tab keys, or a Ctrl-combination of those keys. The
calculator and paste windows are moved, as one would expect, quite naturally
via the arrow keys. However, the tape window uses many of the same positioning
keys for tape positioning purposes. In order to accomodate both window
movement and tape positioning movement, a few "tricks" had to be implemented.
The following table illustrates the positioning/navigating key usage:
WINDOW SCROLL ACTION
------------------------ ---------------
Paste & Tape
Key Press Calculator Tape Display
------------ ---------- ----------- ---------------
UpArrow Up n/a Up One Line
DnArrow Down n/a Down One Line
Ctrl-RtArrow Up Up n/a
Ctrl-LtArrow Down Down n/a
LtArrow Left Left n/a
RtArrow Right Right n/a
Tab Far Right Far Right n/a
End Far Right n/a End of Tape
Shift-Tab Far Left Far Left n/a
Home Far Left n/a Top of Tape
PgUp Top n/a Back 10 Lines
PgDn Bottom n/a Down 10 Lines
Ctrl-PgUp Upper Right Upper Right n/a
Ctrl-PgDn Lower Right Lower Right n/a
Ctrl-Home Upper Left Upper Left n/a
Ctrl-End Lower Left Lower Left n/a
------------ ----------- ----------- ---------------
Also of Note
************
Users may wish to modify the color settings, as this example has been hard
coded for color monitors. The default display accuracy is set to four decimal
places (0.0000); the internal accuracy is whatever the default happens to be
prior to executing PopCalc7.
Best wishes,
Richard H. Price
dATAMAX, Inc.
324 Kingswood Drive
El Paso, TX 79932
(915) 581-7572
ATBBS: HAMMETT
CIS: 71157,762
********************************************************************************
*****************
** DISCLAMER **
*****************
This software is provided "AS IS" and by using this
software, you agree that Richard H. Price will not
be held liable for any reason for any cost you may
incur, whether in the present or the future.
***********************************************************
* ps: For those appreciative (guilt ridden) <g> souls, *
* a $$$ donation would surely make my wife feel better *
* about all the time I've spent on this instead of other, *
* more lucrative ventures! *
***********************************************************