home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
DATABASE
/
DBT123S.ZIP
/
DBTOOLS.DOC
< prev
next >
Wrap
Text File
|
1990-08-09
|
83KB
|
1,961 lines
╔═══════════════════════════════════════════════════╗
║ ║
║ ╓─ ╥────╖ ╓───╥───╖ ─╖ ║
║ ║ ║ ║ ║ ║ ║
║ ║ ╟────╨╖ ║ ║ ║
║ ╓───╢ ║ ║ ║ ╓────╖ ╓────╖ ║ ╓───╖ ║
║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ╙───╖ ║
║ ╙───╨ ╨─────╜ ─╨─ ╙────╜ ╙────╜ ─╨─ ╙───╜ ║
║ ║
╚═══════════════════════════════════════════════════╝
VERSION 1.23 July 1990
Enhancements to the dBASE language
(c) 1989,1990 BERNATH COMPUTER, all rights reserved
1821 Harding Court
Antioch, CA 94509
(415) 778-4423
TABLE OF CONTENTS
Page No.
--------
Introduction ................................... 1
Shareware ...................................... 2
Disclaimer (legalese) .......................... 2
System Requirements ............................ 3
Package Contents ............................... 3
Features ....................................... 3
Loading and Using dBTools ...................... 4
Conventions .................................... 7
dBTools Function Reference
Function 0, INITIALIZE DBTOOLS ............. 8
Function 1, ATSAY .......................... 8
Function 2, BLAT ........................... 8
Function 3, BOX ............................ 8
Function 4, CURSOR ......................... 8
Function 5, ERASE .......................... 9
Function 6, DELAY .......................... 9
Function 7, DITHER ......................... 9
Function 8, FADE ........................... 9
Function 9, HMENU .......................... 10
Function 10, PAUSE .......................... 11
Function 11, PRINTER ........................ 12
Function 12, READSCR ........................ 13
Function 13, RECOLOR ........................ 13
Function 14, RESTORE ........................ 13
Function 15, SAVESCR ........................ 14
Function 16, SCROLL ......................... 14
Function 17, SOUND .......................... 14
Function 18, TWIDDLE ........................ 14
Function 19, UNPOP .......................... 15
Function 20, VMENU .......................... 15
Function 21, WINDOW ......................... 16
Function 22, PAGE ........................... 17
Function 23, NOBLINK ........................ 17
Function 24, PALETTE ........................ 17
Function 25, GETKEY ......................... 19
About the dBTools Demo ......................... 20
Technical Support .............................. 21
Revision History ............................... 22
Things to Come ................................. 23
Appendix A : Error messages
Appendix B : Printer definition files
Appendix C : Musical Note versus Frequency Equivalency Chart
Appendix D : Coding pulldown menu systems
Appendix E : Function Key Scancode Values
Appendix F : Registration Form and Questionaire
dBTools - dBASE III+ Enhancement Tools Page 1
(c) 1990 BERNATH COMPUTER
INTRODUCTION
The dBASE language has become an accepted standard for
custom database applications. A number of third party vendors
have imitated the original package offered by Ashton-Tate (they
say imitation is the highest form of flattery), offering improved
speed, and/or extensions to the dBASE language. Most notable
among these third party vendor products are Clipper, Foxbase/FoxPro,
and dBXL/Quicksilver. Even Ashton-Tate has come up with an improved
and enhanced version of the language in dBASE IV.
However, studies show that there are still a lot of copies of
dBASE III+ being used out there - everybody hasn't rushed out to
purchase a dBASE compiler or even to upgrade to dBASE IV. So whereas
programmers love to bash dBASE III+, there are a lot of people out
there still using it.
One of the areas where I believe dBASE III+ shows its most
dismal performance is in its screen handling capabilities. The
"look and feel" of a typical dBASE application is lackluster, as
a result of the barrenness of the language in this area. It is
one of the first areas where the third party vendors have added
extensions to the language (and Ashton-Tate in dBASE IV).
Nowadays an attractive application should have popup windows
and menus, fast screen writes, and color, features which are missing
or severly limited in dBASE III+, and implemented to various degrees
in the other dBASE versions. The ability to take advantage of your
printer's features is also a desirable capability. These are the type
of enhancements that dBTools provides, from within your copy of dBASE.
dBTools also has some features not found in ANY of the dBASE dialects,
and can be used to enhance any one of them.
dBASE III+ and dBASE IV are trademarks of Ashton-Tate
Foxbase and FoxPro are trademarks of Fox Software, Inc.
Clipper is a trademark of Nantucket Software Ltd.
dBXL and Quicksilver are trademarks of WordTech Inc.
MSDOS is a trademark of Microsoft, Inc.
IBM is a trademark of International Business Machines
Lotus 123 is a trademark of Lotus, Inc.
dBTools - dBASE III+ Enhancement Tools Page 2
(c) 1990 BERNATH COMPUTER
SHAREWARE
dBTools is classified as shareware: meaning that BERNATH
COMPUTER retains all copyrights on the software, but users are
allowed to freely distribute the package as long as they include
all files intact. No charge may be made for this distribution
except for a small handling charge not to exceed $5 (if you're
charging more than this you're soaking people!) such as shareware
libraries and distribution houses charge.
You are allowed to use dBTools for an evaluation period free
of charge, afterwards which you are encouraged to register your
copy with BERNATH COMPUTER for a small registration fee of $25.
What will registration get you?
■ A copy of the latest revision of dBTools without the opening
shareware message, and a copy of the lastest version with the share-
ware message so you can pass it on to others.
■ Notification of upgrades to dBTools and other products by
BERNATH COMPUTER (oh no, another mailing list!).
■ My prayers and blessings (if that sounds strange, just
realize that I am also an ordained minister and the pastor of a
church).
SINGLE USER vs SITE LICENSE
dBTools is essentially a programmer's development tool. As such, the
license is for one individual developing applications. If you have more
than one person developing applications using dBTools, you need a site
license. Or, if you are an individual developing an application using
dBTools that will be distributed commercially or to more than 50 end
users, you need a site license.
See the registration form at the end of this documentation.
I've had a number people tell me what a great product dBTools is, that
in fact I was undercharging for it. So, I've raised the registration from
$15 to $25 in this version, but there are some added features also.
I must say I haven't been encouraged by the number of registrations I've
been getting. C'mon, gang, 25 bucks is CHEAP for what dBTools gives
you!
DISCLAIMER
dBTools is supplied AS IS, with no guarantees or warranties
for its performance or suitableness for any application. BERNATH
COMPUTER will in no way be held liable for any losses or damages
incurred through the use of this product.
The above statement is for protection from sue-happy lawyers.
In reality, I am very interested in providing a quality product
that IS suitable for your application. If there are bugs, I want to
know about them and will endeavor to correct them.
dBTools - dBASE III+ Enhancement Tools Page 3
(c) 1990 BERNATH COMPUTER
SYSTEM REQUIREMENTS
An IBM compatible XT, AT, or 386 machine with MSDOS 2.x or
higher.
A color CGA, EGA, or VGA video card.
A maximum of 32k memory in addition to that required by
dBASE III+.
dBASE III+ or a compatible dBASE compiler or interpreter
(dBTools has been successfully used on Foxbase/FoxPro, dBXL,
Quicksilver, and dBASE IV). A version will be forthcoming which
will work with Clipper (see the THINGS TO COME section).
dBTools CONTENTS
You should have the following files included in your dBTools
package:
DBTOOLS.BIN - the dBTools module
DBTOOLS.DOC - this documentation
DBTQREF.DOC - dBTools Quick Reference Guide
DBT*.PRG - demo programs
PRNDEF.DBF, and .NDX, ESCCODES.DBF, and .NDX
- Printer definition data, an easy
way to create and maintain the
.PRT files.
PRNDEF.FRM - report form to list printer codes
PRTTEST.PRG - standalone printer test program
PROCFILE.PRG- a procedure file with some useful
routines
PROCDEMO.PRG- goes with the procedure file to demo
the routines
CLOSET.PRG - skeleton code for pulldown menu system
GODEMO.BAT - batch file to execute the demo
PAN1091.PRT - Printer dfn for Panasonic 1091i
EPSONFX.PRT - Printer dfn for Epson FX series
OKI192.PRT - Printer dfn for Okidata 192
HPLASER.PRT - Printer dfn for HP Laserjet
IBMPRO.PRT - Printer dfn for IBM Proprinter
*.IMG - Screen image files
PAINT.* - files for PC Magazines screen painter
FEATURES
■ A single .BIN file contains all dBTools functions.
■ Written entirely in assembly language for the ultimate in
speed and compactness.
■ All functions accessible within a .PRG file or from the
dot prompt through the CALL command.
■ 25 functions provided:
Popup windows with boxed and shadowed frames, or draw framed
and shadowed boxes without saving what's underneath.
Vertical moving bar menus, with framed boxes and shadows that
can trap function keys. May be popup/pulldown.
dBTools - dBASE III+ Enhancement Tools Page 4
(c) 1990 BERNATH COMPUTER
Horizontal moving bar menus, a la Lotus 1-2-3, with Fkey trap.
Save and restore up to three entire screens in memory.
Read a screen image from a file into memory.
Eight slideshow-type "fades" of screen images in memory, for
dramatic effects.
Turn off/on the cursor, or set its width from skinny to fat.
Scroll, and/or erase a portion of the screen.
Recolor (change the attribute bytes) of an area of the
screen without changing the text.
A fast alternative to @ SAY that works independently of the
dBASE SET COLOR TO command, with an optional shadow.
Sound commands that allow you to set frequency and duration
of a note, a three note "twiddle", and the computer equiv-
alent of a bronx cheer.
Clear the screen to a "dithered" background using upper
graphics characters, which gives over a hundred background
colors.
Delay an operation (a timed wait command) anywhere from
1/18th second to several seconds.
A more elegant WAIT command (press any key to continue....),
with an optional user defined message and the ability to trap
Function and other control keys.
A user definable printer driver which allows you to take advan-
tage of your printer's features (Bold, underline, pitch, font,
italic, etc.) from within dBASE.
Write invisibly to a different video page, and then activate the
page "instantly".
Ability to set the EGA color palette, and choose between blinking
or high intensity background attributes.
Trap keystrokes and return unambiguous scancodes.
LOADING AND USING dBTools
To make the functions of dBTools available to dBASE you must
first load the dBTools module. This is the single file DBTOOLS.BIN.
This file must be where dBASE can locate it, such as in the current or
the SET PATH TO subdirectory. Then execute the commands:
LOAD DBTOOLS
CALL DBTOOLS WITH "0"
dBTools - dBASE III+ Enhancement Tools Page 5
(c) 1990 BERNATH COMPUTER
from a .PRG file or from the dot prompt. A brief shareware message will
appear (not in registered copies). Press ENTER, and then the dBTools
functions will be available.
Here is a programming tip that will allow you to avoid hard
coding subdirectory names in your applications:
I have my dBASE files in a subdirectory C:\DB3, my dbTools
files in C:\DBTOOLS, and my different dBASE applications files
(the .PRG's, .DBF's, etc.) in other subdirectories. I set three
MSDOS environment variables from a batch file GOAPP.BAT in my
application subdirectory:
set DBPATH=C:\appsubdir
set DBTOOLS=C:\DBTOOLS
set DBTPRT=PAN1091
cd \db3
dbase c:\appsubdir\APPSTART
where appsubdir is the name of the subdirectory my applications
programs are in, and APPSTART.PRG is the name of the frontend
startup program of my application.
APPSTART.PRG will look something like this:
* APPSTART.PRG - application startup program
public gPATH,gPRT,gPRTFILE && declare a global var
do LOADDBT && load and initialize dBTools
do APPMAIN && execute your own application
*
The file LOADDBT.PRG is included in the distribution package, and
contains the following code:
* LOADDBT.PRG - load and initialize dBTools
gPATH = GETENV("DBPATH") && fetch pathname from environment
SET PATH TO &gPATH && use it to set path
gDRV = SUBSTR(gPATH,1,2) && get drive name
SET DEFAULT TO &gDRV && set default drive
gPATH = TRIM(gPATH)+"\"
mTOOLS = GETENV("DBTOOLS") && get dBTools location
mTOOLS = TRIM(mTOOLS)+"\"
mEXP = mTOOLS + "DBTOOLS"
LOAD &mEXP && use macro to load it
CALL DBTOOLS WITH "0" && initialize dBTools
gPRT = GETENV("DBTPRT") && get default printer
gPRTFILE = gPATH+gPRT+".PRT" && turn it into fully qualified filename
mEXP = "11,0,0,"+gPRTFILE && create a memvar to load the printer
CALL DBTOOLS WITH mEXP && driver
RETURN
The above scenario has the advantage that if you want to
change any of the subdirectories used by your application, all
you have to do is change the batch file GOAPP.BAT which sets the
environment variables.
dBTools - dBASE III+ Enhancement Tools Page 6
(c) 1990 BERNATH COMPUTER
THE CALL COMMAND
dBTool functions (or any .BIN module loaded into dBASE, for
that matter) are accessed with the CALL command:
CALL DBTOOLS WITH <parameter string>
where <parameter string> can either be a string memory variable
or text in quotes. The first value in the parameter string should
be the dBTools function number (1-25), then a comma, and then
whatever parameters the function requires, separated by commas.
For example, the CURSOR function, function 4, has two
parameters, toggled with a "1" or a "0": the first specifies
whether the cursor is to be turned on or off, the second whether
it is to be a normal or fat cursor.
To turn the cursor off, you could write
CALL DBTOOLS WITH "4,0,0".
To turn the cursor on with a fat cursor, you would write
CALL CURSOR WITH "4,1,1".
Alternatively you could use a memory variable for the
parameters, such as
STORE "4,1,0" TO mPARM
CALL DBTOOLS WITH mPARM
The parameter string can consist of any valid dBASE
expression as long as it evaluates to the proper parameters for
the function.
If the parameter string is incorrect in some way, dBTools
will beep, blank the screen, display a diagnostic error message
and the offending parameter string, then pause for a keystroke.
After receiving the keystroke, operation will resume with the next
dBASE statement after the CALL command. A list of error messages
is in Appendix A.
dBTools - dBASE III+ Enhancement Tools Page 7
(c) 1990 BERNATH COMPUTER
CONVENTIONS
In the command reference that follows, the following
conventions will be used:
FG = foreground color BG = background color
Using the DOS color parameters 0 through 15:
0 = black 8 = dark grey
1 = blue 9 = bright blue
2 = green 10 = bright green
3 = cyan 11 = bright cyan
4 = red 12 = bright red
5 = magenta 13 = bright magenta
6 = brown 14 = yellow
7 = grey 15 = white
Note that using background colors > 7 will result in blinking
text, unless function 23 has been used to set blinking Off.
All parameters should be separated by commas.
Parameters enclosed in <> are optional.
Columns are numbered 0 through 79, rows are 0 through 24.
Window and box coordinates:
ULC = upper left column ULR = upper left row
LRC = lower right column LRR = lower right row
dBTools - dBASE III+ Enhancement Tools Page 8
(c) 1990 BERNATH COMPUTER
DBTOOLS FUNCTION REFERENCE
■ INITIALIZE DBTOOLS, function 0 : Execute this function once
right after loading dBTools. A shareware message will appear once
(not in registered versions). Press ENTER to continue.
----------------------------------------------------------------------
■ ATSAY, function 1 : an fast alternative to @ SAY commands.
CALL DBTOOLS WITH "1,<S>,row,col,FG,BG,page,text"
The S parameter is optional. If included, a background
shadow will appear under the text.
page = video page. Normally should be 0.
Example:
CALL DBTOOLS WITH "1,5,10,15,1,0,Enter Last Name:"
----------------------------------------------------------------------
■ BLAT, function 2 : a computerized bronx cheer.
CALL DBTOOLS WITH "2"
This function is used to provide "negative" audio feedback, such
as when an incorrect entry is made by a user.
----------------------------------------------------------------------
■ BOX, function 3 : draw a framed box with optional shadow.
CALL DBTOOLS WITH "3, ULR, ULC, LRR, LRC, FG, BG, frame,
page, shadow"
ULR, ULC, LRR, LRC form the coordinates of the box.
Frame = 0 : no frame
Frame = 1 : single line
Frame = 2 : double line
Frame = 3 : single on horizontal, double on vertical
Frame = 4 : double on horizontal, single on vertical
Frame = 5 : thick line frame
Shadow = 0 for no shadow, = 1 for shadow
Page = video page, 0 to 3
Example: CALL DBTOOLS WITH "3,10,25,15,60,15,1,2,0,1"
---------------------------------------------------------------
■ CURSOR, function 4 : turn cursor on/off and control its shape.
CALL DBTOOLS WITH "4, off/on, normal/fat"
The On and Fat toggles are set by setting the parameters to "1",
and reset by specifying "0".
Example:
CALL DBTOOLS WITH "4,0,0" && cursor off
CALL DBTOOLS WITH "4,1,1" && cursor on and fat
CALL DBTOOLS WITH "4,1,0" && cursor on and normal
dBTools - dBASE III+ Enhancement Tools Page 9
(c) 1990 BERNATH COMPUTER
■ ERASE, function 5 : erase text
CALL DBTOOLS WITH "5,ULR,ULC,LRR,LRC,<BG>"
Erases an area of the screen, specified by its corner coordinates
ULR,ULC,LRR,LRC. The background color BG is optional. If used, text is
erased and set to the color specified by BG. If BG is not specified,
text will be blanked, but the underlying colors will remain unchanged.
Examples:
CALL DBTOOLS WITH "5,5,10,5,22" && erases 12 chars, retaining
current colors
CALL DBTOOLS WITH "5,10,0,11,79,1" && erases two lines in blue
----------------------------------------------------------------------
■ DELAY, function 6 : timed delay
CALL DBTOOLS WITH "6,delay"
This function suspends execution of any command for the time
specified by Delay, which is in eighteenths of seconds (Delay = 18 =
one second). It is derived from the system clock and so is accurate
with any processor.
----------------------------------------------------------------------=
■ DITHER, function 7 : paint a background using graphics characters
and "dithering".
CALL DBTOOLS WITH "7,CharType,FG,BG,Page"
CharType = 0 : <solid BG color>
CharType = 1 : ░
CharType = 2 : ▒
CharType = 3 : ▓
CharType = 4 : <solid FG color>
Over a hundred color shades are possible by combining
different CharType's, FG's, and BG's. You can also use this to
clear alternate video pages.
■ FADE, function 8 : Use one of several slideshow type "fades" to
display a screen image on the screen.
CALL DBTOOLS WITH "8, fadetype, mode/color, delay, slot"
Fadetype: 0 = instant snap to screen
1 = vertical wipe, top to bottom
2 = vertical wipe, bottom to top
3 = horizontal wipe, left to right
4 = horizontal wipe, right to left
5 = horizontal alternate fingers wipe
6 = vertical alternate fingers wipe
7 = sparkle fade
dBTools - dBASE III+ Enhancement Tools Page 10
(c) 1990 BERNATH COMPUTER
Mode/Color: If this parameter is 0, it is assumed the screen data
is stored in an memory screen image specified by Slot (ie, a screen
image produced either by the SAVESCR function 15 command or the READSCR
function 12 command). If Mode/Color is nonzero, it is assumed you want
to clear the screen to a solid color specified by the Color parameter,
using the specified fade type.
The Delay parameter controls how fast the fade will occur. The
delay is not derived from the system clock, so there may be some varia-
tion between processors (although it does sense whether you're running
on an 8086, 286, or 386 machine and attempt to adjust for it).
Example: Fade to a screen image stored in slot 3, using fade 2.
CALL DBTOOLS WITH "8,2,0,5,3"
Example: Clearing the screen to green using the sparkle fade.
CALL DBTOOLS WITH "8,7,2,5,0"
When fading to a color, the Slot parameter is ignored.
----------------------------------------------------------------------
■ HMENU, function 9 : horizontal bar menu.
mMENUSTR="9, <Y>, choice, row, col, LowFG, LowBG,HighFG, HighBG,;
item1, item2, ....., @"
CALL DBTOOLS WITH mMENUSTR
This function allows you to create scrolling horizontal moving bar
menus a-la Lotus 1-2-3. The arrow keys, along with the End and Home
keys, are used to position the highlight bar, and the <─┘ (Enter) key
used to select the item. Alternatively, you may press the first letter
of the menu item to select (pressing Enter is not necessary).
If you specified the optional Y parameter, HMENU will also trap
and return the value of Function and other control keys.
The colors specified by LowFG and LowBG control the color of the
nonhighlighted text, and HighFG and HighBG control the colors of the
highlighted text.
The parameter string MUST be set up with a memory string
variable, as the value of the selected item is returned in it.
You may add leading and trailing spaces to the menu items to get
them to space out as desired.
Specifying a 0 initial choice displays the menu, but no options
are highlighted and the program exits the function without waiting for a
keystroke.
Specifying a NEGATIVE initial conditions will highlight the
specified the specified option, but the function will exit without
pausing for a keystroke (See Appendix D for application).
dBTools - dBASE III+ Enhancement Tools Page 11
(c) 1990 BERNATH COMPUTER
Example:
mCHOICE = 1
mPARM = "9,"+STR(mCHOICE,2)+",24,25,11,1,1,3,"
mPARM = mPARM + "A)dd,C)hange,D)elete,Q)uit,@"
* don't forget the commas and terminating @ sign!
CALL DBTOOLS WITH mPARM
mCHOICE = VAL(mPARM)
Note that the value of Choice (the string representation of the
memory variable mCHOICE imbedding in the parameter string) determines
which of the menu items is initially highlighted. The value of the
selected item is returned in the first two characters of the parameter
string, and can be converted to a numeric variable with the dBASE VAL(
function. Pressing the Escape key returns a value of 0.
The "@" character at the end of the parameter string is mandatory,
as it signals dBTools that there are no more menu items.
If the Y parameter is specified and a function key is pressed,
HMENU will return a value of 99 for mCHOICE, the 4th byte of the
parameter string will be set to the first scancode for the function key
(see Appendix E for scancode values), the 5th byte to the second
scancode, and the currently highlighted option will be in the 6th byte:
mPARM = "9,Y,"+STR(mCHOICE,2)+",24,25,11,1,3,Add,Change,Delete,@"
CALL DBTOOLS WITH mPARM
mCHOICE = VAL(mPARM)
IF mCHOICE = 99 && Fkey was pressed
* See Note
mKEY = ASC(SUBSTR(mPARM,4,1))-1 && Extract 1st scancode
mSCAN = ASC(SUBSTR(mPARM,5,1))-1 && Extract 2nd scancode
mCHOICE = ASC(SUBSTR(mPARM),6,1)) && Extract highlighted opt
ENDIF
Note: Because dBASE cannot handle strings with CHR(0) in them, the
scancodes are incremented by one in the parm string, and so you must
subtract 1 when you extract them.
----------------------------------------------------------------------
■ PAUSE, function 10 : an alternative to dBASE's WAIT command.
CALL DBTOOLS WITH "10, row, col, FG, BG"
CALL DBTOOLS WITH "10, row, col, FG, BG, <alternate message>"
mPARM = "10,<Y>, row, col, FG, BG, <alt msg>"
CALL DBTOOLS WITH mPARM
mKEY = ASC(mPARM)-1
mSCAN = ASC(SUBSTR(mPARM,2,1))
The PAUSE command has three options:
In the first example it will print the message "Press any key to
continue..." in the color specified by FG and BG, at the position
specified in Row and Col, and wait for a keystroke.
In the second example, an alternate user defined message may be
specified in place of the default "Press any key..."
In the third example with the Y parameter specified, PAUSE will
trap and return the scancode values of function keys or cursor control
keys pressed (see Appendix E). ESC will be returned as 27,0. Note that
a memory variable string must be used for the parameters.
dBTools - dBASE III+ Enhancement Tools Page 12
(c) 1990 BERNATH COMPUTER
■ PRINTER, function 11 : Send escape codes to printer.
CALL DBTOOLS WITH "11,0,0,filespec" && load printer dfn
mPARM="11,0,1,"+SPACE(31)
CALL DBTOOLS WITH mPARM && get printer info
CALL DBTOOLS WITH "11,seqcode" && send escape sequence
This function is a general purpose non-graphics printer driver
which allows you to define escape codes in a text file and call
them from within dBASE to control your printer's attributes. Calling
this function with a seqcode will send the escape sequence specific
to your printer to control pitch, bold, underline, and whatever
other features your printer offers. Changing to another printer is
just a matter of calling function 11 with a different filespec.
The printer control codes must be loaded into memory before they
can be used. This is accomplished by calling dBTools function 11 with
seqcode = 0, and the filename that contains the codes:
CALL DBTOOLS WITH "11,0,0,EPSON.PRT"
Once the codes are loaded, up to 48 printer commands are available.
These are user definable. A suggested format is shown below:
seqcode Action
------- -----------------------------
1 Initialize printer
2 Set to 10 CPI
3 Set to 12 CPI
4 Compressed print ON
5 Compressed print OFF
6 Double wide ON
7 Double wide OFF
8 Bold ON
9 Bold OFF
10 Italic ON
11 Italic OFF
12 Underline ON
13 Underline OFF
14 Superscript ON
15 Superscript OFF
16 Subscript ON
17 Subscript OFF
18 NLQ ON
19 NLQ OFF
20 Set to 6 LPI
21 Set to 8 LPI
22 Set to 4 LPI
23 Set left margin
A special program is included with the demo that maintains a data-
base of printers and their escape sequences, from which the printer
definition files can be automatically created (see Appendix B).
dBTools - dBASE III+ Enhancement Tools Page 13
(c) 1990 BERNATH COMPUTER
Calling printer function 11 with subfunctions 0,1 returns informa-
tion about the selected printer. A 38 byte parameter string is first
set up as shown below, dBTools is called, and information is returned
in the parameter string:
mPARM = "11,0,1,"+SPACE(31) && set up parameter string
CALL DBTOOLS WITH mPARM && get printer info
mNUMESC = ASC(SUBSTR(mPARM,1,1)) && number of defined esc codes
mPRTYPE = ASC(SUBSTR(mPARM,2,1))-1 && Printer type:
&& 0 = non-programmable
&& 1 = 80 col dor matrix
&& 2 = 132 col dot matrix
&& 3 = laser/inkjet
mPRNAME = SUBSTR(mPARM,3,36) && Name of printer
The escape sequences are sent to the printer by calling dBTools
function 11 with the appropriate seqcode:
CALL DBTOOLS WITH "11,seqcode"
See Appendix B for instructions on how to create Printer Definition
files.
----------------------------------------------------------------------=
■ READSCR, function 12 : read a screen image from a file into memory.
CALL DBTOOLS WITH "12, slot, filespec"
The Slot number may be 1-3. Once in memory, the image may be disp-
layed by either using RESTORE (function 14) or FADE (function 8).
----------------------------------------------------------------------=
■ RECOLOR, function 13 : recolor an area of the screen without
changing the text.
CALL DBTOOLS WITH "13,ULR,ULC,LRR,LRC,FG,BG"
Example: CALL DBTOOLS WITH "13,10,15,17,45,11,1"
----------------------------------------------------------------------=
■ RESTORE, function 14 : write a screen image stored in memory to the
screen.
CALL DBTOOLS WITH "14,slotnumber,page"
The slotnumber is 1-3 and must have had something stored in
it previously.
Page is 0-3.
Example: CALL DBTOOLS WITH "14,3,0,1"
dBTools - dBASE III+ Enhancement Tools Page 14
(c) 1990 BERNATH COMPUTER
■ SAVESCR, function 15 : save current screen image into a memory
slot.
CALL DBTOOLS WITH "15,slotnumber"
You may save up to 3 memory images simultaneously, numbered
1-3.
--------------------------------------------------------------------
■ SCROLL, function 16 : scroll a portion of the screen.
CALL DBTOOLS WITH "16,ULR,ULC,LRR,LRC,FG,BG,numlines,direction"
Numlines = number of lines to scroll.
Direction = 1, up. Direction = 2, down.
Example:
DO WHILE .NOT. EOF()
@ 15,30 SAY TRIM(LAST_NAME)+", "+FIRST_NAME+SPACE(6)+SSN
CALL DBTOOLS WITH "16,5,25,15,70,7,1,1,1"
SKIP
ENDDO
----------------------------------------------------------------------=
■ SOUND, function 17 : sound the speaker.
CALL DBTOOLS WITH "17, frequency, duration"
This function allows you to play musical notes. Entire tunes can
be played, but they are time consuming to code.
The legal frequency range is 50 to 17000 cycles per second (although
you shouldn't expect much sound out of a PC speaker at the frequency
extremes).
Duration is in clock tics, which are one eighteenth seconds (ie,
one second = 18).
Example:
A sound equivalent to the TWIDDLE function 18 is:
CALL DBTOOLS WITH "17,300,3"
CALL DBTOOLS WITH "17,800,3"
CALL DBTOOLS WITH "17,1200,3"
See Appendix C for a musical note to frequency conversion chart.
----------------------------------------------------------------------
■ TWIDDLE, function 18 : three note "twiddle" sound.
CALL DBTOOLS WITH "18"
This function produces a "positive" audio feedback, as opposed to
the BLAT function above which produces a negative feedback. It can be
used as an alternative to BEEP or ? CHR(7).
dBTools - dBASE III+ Enhancement Tools Page 15
(c) 1990 BERNATH COMPUTER
■ UNPOP, function 19 : close a popup window.
CALL DBTOOLS WITH "19,windownumber"
This function closes a popup window and restores the screen
data underneath the window. If you attempt to restore a windownumber
that has not previously been saved with the WINDOW command, an error
will result. Legal range for Windownumber is 1-24.
----------------------------------------------------------------------
■ VMENU, function 20 : vertical moving bar menu. Optional popup.
There are two forms of the VMENU function, one that produces a
popup menu that can be UNPOP'd, and one that just draws the menu on
the screen and leaves it up after you exit.
Non-popup form:
CALL DBTOOLS WITH "20,<Y>,choice,0,ULR,ULC,LRR,LRC,LowFG,LowBG,
frame,shadow,HighFG,HighBG,Jus,item1,item2,
item3,....,@"
Popup form:
CALL DBTOOLS WITH "21,windownumber,ULR,ULC,LRR,LRC,FG,BG,
frame, shadow"
CALL DBTOOLS WITH "20,<Y>,choice,windownumber,HighFG,HighBG,Jus,
item1,item2,....,@"
Note that a window box must be opened with the WINDOW function
first (function 21), then the VMENU function is called with fewer para-
meters.
Specifying a Windownumber of 0 signals the function that it is a
nonpopup type, and it will look for the box parameters.
The LowFG and LowBG parameters specify both the window frame
colors and the unhighlighted text colors.
The Jus (justification) parameter controls whether the menu text
will be left justified (for Jus = 1), or centered in the box (for
Jus = 2).
The box parameters are the same as in the BOX function (3).
The up/down arrows, Home and End will position the highlight bar,
and <─┘ (Enter) selects the item. Or, pressing the first letter of the
menu item text will also select an item. Pressing the Escape key
returns a value of 0.
dBTools - dBASE III+ Enhancement Tools Page 16
(c) 1990 BERNATH COMPUTER
Example: Non-popup menu
mCHOICE = 1
mPARM = "20,"+STR(mCHOICE,2)+",0,5,10,9,35,14,4,1,1,12,0,2,"
mPARM = mPARM + "Data Entry,Reports,Utilities,Quit,@"
CALL DBTOOLS WITH mPARM
mCHOICE = VAL(mPARM)
Example: Popup Menu
CALL DBTOOLS WITH "21,1,5,10,9,35,14,4,1,1" && Window function
mCHOICE = 1
mPARM = "20,"+STR(mCHOICE,2)+",1,12,0,2,"
mPARM = mPARM + "Data Entry,Reports,Utilities,Quit,@"
CALL DBTOOLS WITH mPARM
mCHOICE = VAL(mPARM)
CALL DBTOOLS WITH "19,1" && Unpop window
If the optional Y parameter is specified, VMENU will also trap
and return the scancodes of the control keys pressed (see Appendix E)
in the 4th and 5th bytes, and the currently highlighted option in the
6th byte:
mPARM = "20,Y,"+STR(mCHOICE,2)+",0,5,10,9,35,14,4,1,1,12,0,2,"
mPARM = mPARM + "Data Entry,Reports,Utilities,Quit,@"
CALL DBTOOLS WITH mPARM
mCHOICE = VAL(mPARM)
IF mCHOICE = 99 && Fkey was pressed
mKEY = ASC(SUBSTR(mPARM,4,1))-1 && Extract 1st scancode
mSCAN = ASC(SUBSTR(mPARM,5,1))-1 && Extract 2nd scancode
mCHOICE = ASC(SUBSTR(mPARM,6,1)) && Extract highlighted option
ENDIF
----------------------------------------------------------------------
■ WINDOW, function 21 : open a popup window.
CALL DBTOOLS WITH "21, windownumber, ULR, ULC, LRR, FG, BG,
frame, shadow"
The parameters for WINDOW are similar to those of BOX,
except that the screen underneath the box is first saved in
memory. There is enough memory available to hold a bit more
than two full screens, so make sure you close them with UNPOP
afterwards to make the memory available to the heap again.
Valid windownumbers are 1-24.
Example:
CALL DBTOOLS WITH "21,1,13,45,18,76,14,1,1,1"
dBTools - dBASE III+ Enhancement Tools Page 17
(c) 1990 BERNATH COMPUTER
■ PAGE, function 22 : set active page.
CALL DBTOOLS WITH "22,pagenum"
Color adapters (CGA, EGA, VGA) have actually 16k of memory set
aside for video mapping. When in text mode, which requires only
4k for a full screen, the remaining 12k can be written to
"invisibly", and then activated later. The four video pages are
numbered 0-3. You can use the DITHER, ATSAY, BOX, READSCR and
RECOLOR functions to write to a page other than page 0, and then
display it instantly by activating the page with this function.
---------------------------------------------------------------------
■ NOBLINK, function 23 : enable/disable blinking.
CALL DBTOOLS WITH "23,blinkattr"
This function enables you to choose between blinking color
attributes or high intensity background colors (but not
simultaneously).
blinkattr=0, disables blinking, enables high intensity BG
blinkattr=1, enables blinking, disables high intensity BG
Note: use the * in dBASE to denote a blinking color.
Example: CALL DBTOOLS WITH "23,0" && disable blinking
SET COLOR TO N/*GR,+GR/N && black on yellow BG
---------------------------------------------------------------------
■ PALETTE, function 24 : set EGA/VGA color palette
CALL DBTOOLS WITH "24,1,RR/VV,RR/VV,RR/VV,...."
CALL DBTOOLS WITH "24,0"
The EGA card has 16 color registers, so it can only display 16
colors, numbered 0-15, at a time. However, the current set of 16
colors may be chosen from a "palette" of 64 possible colors,
numbered 0-63. The default color set consists of the colors:
0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63
corresponding to black, blue, green, cyan, red, magenta, brown,
dark grey, grey, bright blue, bright green, bright cyan, bright
red, bright magenta, yellow, and white.
In the first version of the command, you can use function 24 to
set from one to all 16 colors with one command.
CALL DBTOOLS WITH "24,1,RR/VV,RR/VV,RR/VV,....."
where RR is the register number 0-15 to change, and VV is the color
value 0-63 to set it to. For example, to change brown to a nice
orange color,
CALL DBTOOLS WITH "24,1,6/38"
Now in dBASE whenever you access the color GR (which gives
brown), it will appear orange. The change occurs immediately, so
any brown areas on the screen will turn orange. You can get some
interesting "animation" effects with this (see the demo Color
Palette).
dBTools - dBASE III+ Enhancement Tools Page 18
(c) 1990 BERNATH COMPUTER
Watch what combinations you use, because it can get very confusing
executing a command like CALL EGAPAL WITH "1,2/37" and then setting
your colors SET COLOR TO +GR/G and having it come out yellow on
hot pink (yuk)!
The entire palette can be reset to the default colors by
executing the command:
CALL DBTOOLS WITH "24,0"
Note that function 24 only works for EGA and VGA adapters. If
you have a CGA adapter, function 24 will just return without doing
anything.
Table 1 below gives the 64 colors and an approximate description
of their appearance, with the default colors in CAPS:
Table 1
0 BLACK (0) 16 green black
1 BLUE (1) 17 dark blue violet
2 GREEN (2) 18 bright yellow green
3 CYAN (3) 19 light green
4 RED (4) 20 BROWN (6)
5 MAGENTA (5) 21 magenta
6 olive 22 bright yellow green
7 GREY (7) 23 light green
8 blue black 24 almost black
9 bright blue 25 bright blue
10 med green 26 bright green
11 med blue 27 bright cyan
12 med red 28 reddish brown
13 blue violet 29 purple
14 olive 30 yellow green
15 light blue violet 31 light cyan
32 almost black 48 almost black
33 dark blue violet 49 dark blue violet
34 med green 50 bright yellow green
35 med cyan 51 light green
36 bright red 52 red orange
37 hot pink 53 red violet
38 orange 54 yellow
39 light pink 55 light yellow
40 almost black 56 DARK GREY (8)
41 bright blue 57 BRIGHT BLUE (9)
42 med green 58 BRIGHT GREEN (10)
43 light blue 59 BRIGHT CYAN (11)
44 bright red 60 BRIGHT RED (12)
45 bright magenta 61 BRIGHT MAGENTA (13)
46 light orange 62 YELLOW (14)
47 light magenta 63 WHITE (15)
dBTools - dBASE III+ Enhancement Tools Page 19
(c) 1990 BERNATH COMPUTER
■ GETKEY, function 25 : trap keystrokes and return unambiguous codes
mPARM = "25,0" no character echo, OR
mPARM = "25,1" with character echo
CALL DBTOOLS WITH mPARM
mKEY = ASC(mPARM)-1
mSCAN = ASC(SUBSTR(mPARM,2,1))-1
Letter and number keys will return a unique value in mKEY, and
mSCAN will be 0. Function and control keys will return mKEY = 0
and a unique value in mSCAN. Of special interest is the ENTER key
which returns mKEY=13 and mSCAN=0, and the ESC key which returns
mKEY=27 and mSCAN=0.
See the chart in Appendix E for a list of scancodes.
dBTools - dBASE III+ Enhancement Tools Page 20
(c) 1990 BERNATH COMPUTER
ABOUT THE DEMO
Included in the dBTools package is a demonstration program that
illustrates the many features of dBTools. The source code is included,
so it also acts as a tutorial on how to use dBTools.
To run the demo you will require dBASE III+ or a dBASE compatible
interpreter (this includes dBXL and QuickSilver, Foxbase, FoxPro, and
dBASE IV. This version will not work with Clipper, but I will shortly
have a version that does). The files DBT*.PRG and the .PRT printer
definition files should be in the same subdirectory.
Set up three environment variables:
SET DBPATH=<path where the .PRG and .PRT files can be found>
SET DBTOOLS=<path where the file DBTOOLS.BIN can be found>
SET DBPRT=<name of .PRT printer definition file to load>
select the subdirectory where dBASE is found:
CD /DB3 (or wherever)
DBASE <path>\DBTDEMO (path is where DBTDEMO.PRG is found)
For example, let's say you have dBASE in a subdirectory C:\DB3,
and you copy all the necessary dBTools files into a subdirectory
called C:\DBTOOLS. You could execute the demo with the following
batch file:
DBPATH=C:\DBTOOLS
DBTOOLS=C:\DBTOOLS
DBTPRT=EPSONFX && or whatever
CD\DB3
DBASE C:\DBTOOLS\DBTDEMO
This batch file is included in the dBTools package as GODEMO.BAT.
If you are using subdirectories other than those in the example, you
may modify GODEMO.BAT with a text editor.
THE PROCEDURE DEMO
The PROCDEMO programs can be setup in a similar way with batch files
and environment variables. A sample batch file called PD.BAT is included
which will work if all your files are in a subdirectory C:\DBTOOLS.
SCREEN PAINTER
Inquiries have been made as to how to create the screen images to
use with the FADE command. I have included as a convenience in this
distribution package PC Magazine's PAINT.COM, authored by Jeff Prosise.
Doc's are in PAINT.DOC. Another excellent screen painter you can find
on most BBS's is THEDRAW by Ian Davis.
dBTools - dBASE III+ Enhancement Tools Page 21
(c) 1990 BERNATH COMPUTER
TECHNICAL SUPPORT
If you are having problems using dBTools, or encounter a bug
(get out the Raid!), I want to hear about it. I would like to say you
can call our 24 hour toll free technical support line and one of our
trained technical advisors will assist you, but I would be lying. The
fact is, "BERNATH COMPUTER" is just me, Scott Bernardi, and I don't do
this full time. I pastor a church AND I work a full time job as a
management analyst and programmer (I do a lot of FoxPro programming).
Therefore I am not always the easiest person to get a hold of. You
may call me at (415) 778-4423 on Tuesday and Friday eves or on
Saturday. During the day, try (415) 356-3664 (I'd rather you called me
at home on evenings since this is my regular work number).
For registered users, if you encounter a bug in dBTools, I'll send a fix
out to you. You'll find me very responsive. In fact, the dBASE IV and
QuickSilver compatible versions came about from user requests.
For non registered users, I'll try to maintain the lastest version on
the following BBS's:
INFOLINC (415) 778-5929
The File Bank (619) 728-4318
Bertha Board (209) 239-9833
Charisma (415) 349-6576
You may write to me at:
BERNATH COMPUTER
1821 Harding Court
Antioch, CA 94509
dBTools - dBASE III+ Enhancement Tools Page 22
(c) 1990 BERNATH COMPUTER
REVISION HISTORY
10/31/89 - Initial Release
02/26/90 - Version 1.1. No bugs reported as yet. Function key support
added to HMENU, VMENU, and PAUSE. Alternate message capability
added for PAUSE.
Demonstration procedure file added.
03/15/90 - Version 1.11. If one of the sound commands were called right
after loading dBTools, it would lock the computer. Fixed by
adding the initialization function 0 to be called right after
loading dBTools.
05/10/90 - Version 1.2. Added the NOBLINK and PALETTE commands.
06/29/90 - Version 1.21. Made some changes to make it run under dBASE IV
and QuickSilver.
07/09/90 - Version 1.22. Made some corrections to the documentation.
PAINT.COM screen painter included.
I decided to put a sharware message in the initialization
routines, and raise the price to $25 (hey, people, I'm just
being honest!). The only ones to receive version 1.21 were
registered users.
07/20/90 - Version 1.23.
Added the GETKEY function.
Added expanded function key trapping capability to HMENU,
VMENU, and PAUSE.
HMENU accepts a 0 or negative initial choices to bypass the
wait for keystroke.
Added the Pulldown Menu System code to the demo.
Fixed a bug in the printer driver.
Cleaned up some of the error messages.
dBTools - dBASE III+ Enhancement Tools Page 23
(c) 1990 BERNATH COMPUTER
THINGS TO COME
I'm currently working on Version 2.0 'PRO' of dBTools, which will add
increased storage capacity for screens and windows, some more sound
effects, MOUSE SUPPORT!!, "dialog buttons", enhanced menu capabilities,
color schemes like FoxPro, online syntax help, the ability to use dBASE
type color specifications (W/N, etc) or color numbers interchangably,
string, encryption, and whatever else I might think of.
Version 2.0 will not be distributed as shareware, so version 1.2x will
be the last shareware versions available. The price of version 2.0 will
probably be $45, but registered users of the shareware version will be
given full credit for their registration towards Version 2.0.
This is not an official announcement yet since I'm still working on it.
When I'm finished, I'll probably put some kind of demo on the BBS's,
and I'll notify registered users by mail.
I'm also toying with the idea of a Clipper library version. I can get
dBTools to work with Clipper right now, but it still uses the kludgey
CALL interface which is necessary with all the other dBASE compilers
and interpreters (if you're interested, contact me).
Please use the questionaire/survey form to express your own ideas for
what you'd like to see in dBTools.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER A-1
APPENDIX A - ERROR MESSAGES
The most common source of errors are incorrect parameter strings,
or dBTools can't find a specified file. Upon encountering an error,
dBTools will beep, blank the screen, print a diagnostic message about
the error, print the offending parameter string, and pause for a key
stroke. Upon receiving a keystroke, your dBASE program will continue
with the next statement.
1 : Invalid function.
A function code outside the 1-25 range was specified.
2 : Error in parameters.
A missing or invalid parameter was specified in the parameter
string.
3 : Parameter out of range.
A numeric parameter was specified outside its legal range.
May also occur when the function is expecting numeric data
but encounters alpha data.
4 : Color monitor required.
The Page function 22 requires a color monitor.
5 : Invalid color attributes.
A FG or BG color was specified outside the legal 0-15 range.
6 : Invalid screen file.
A file was specified in the READSCR function 12 that was not
recognizable as a 4000 byte screen image.
7 : Cannot restore a screen that hasn't been saved.
Results from trying to call RESTORE function 14 before
READSCR function 12 or SAVESCR function 15 has saved an
image in the specified slot.
8 : Invalid coordinates.
Screen coordinates outside the row range of 0-24 or outside
the column range of 0-79 have been specified.
9 : Window hasn't been saved.
An attempt to UNPOP a window with function 19 before it has
been opened with function 21 will cause this error.
10: Invalid window number.
Legal range is 1-24.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER A-2
APPENDIX A - ERROR MESSAGES
11 : Not enough memory to save window.
A limited amount of memory space is available (a bit more than
two full screens) to store areas underneath windows, which can
be exceeded by trying to maintain too many open windows at a
time. If you make sure you UNPOP a window when you are done with
it, you shouldn't encounter this error.
12 : Error allocating HEAP space.
Rarely will occur. Has to do with the allocating of memory space
for popup windows or temporary buffers for files.
13 : Invalid printer code file.
The '@PRNDEF' in the first line of a .PRT file acts as a
"signature" to determine whether the specified file is a valid
printer definition file.
14 : Invalid printer code.
An attempt has been made to access an escape sequence outside
the range defined for the currently loaded printer dfn file.
The maximum value is stored in line 3 of the definition file.
Maximum value is 48.
15 : Invalid video page specified.
Legal range is 0-3.
16 : Error reading file.
If a specified file is not found, or cannot be opened for some
reason, this error will occur.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER B-1
APPENDIX B - PRINTER DEFINITION FILES
A printer definition file contains the escape codes that control
the features of your printer. It can be created or modified with any
text editor or word processor (in non document mode) that will produce
a pure ASCII file. Or alternatively, a dBASE program and associated
datafiles are included in the demo which maintain a database of printers,
their available features, and the escape sequences to activate those
features. Registration includes the right to incorporate the printer
maintenance files into your application. Printer definition files can
then be automatically created from this database (by far the easiest
way to go!).
Included in the dBTools package are definition files for five pop-
ular printers (ones where I could get my hands on the manuals).
A printer definition file can have any filename, but should have a
.PRT extension. The first line of the file should have the word "@PRNDEF"
(don't include the quotes) by itself, with no leading spaces.
The second line of the file specifies the name/type of the printer,
eg, EPSON FX-286e or whatever. This printer description can be up to 36
characters long.
The third line should be a number 0-3 which defines the printer type
as follows:
0 = nonprogrammable
1 = 80 col dot matrix
2 = 132 col dor matrix
3 = laser/inkjet
The following lines will be the actual escape sequences. Any number
of escape sequences may be defined, up to 48. Each line should start with
the sequence code (1-48), immediately followed by a colon (:), at least
one space, and then the decimal equivalents of each escape sequence byte
separated by commas. Up to 16 bytes may be included in a sequence.
A sequence is terminated by an ending comma followed by the @ char-
acter. This is mandatory. End the line with a carriage return.
The last line of the file MUST be two '@' signs by themselves:
@@
The escape sequences can be anything you like, but you should main-
tain consistency between files. This will enable you to program applica-
tions with generic calls to dBTools to perform particular functions, no
matter what printer is loaded at the time.
Examine the included .PRT files for examples.
To test your printer codes, run the demo and select the Printer
Driver demonstration, or run PRTTEST within dBASE. Specify your new .PRT
file as the one to load, and a test sheet will be printed.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER C-1
APPENDIX C - Musical note versus Frequency Equivalency Chart
Octave 0
---------------
A 110
Bb 117
B 124
Octave 1 Octave 4 Octave 7
--------------- --------------- ---------------
C 131 C 1047 C 8372
C# Db 139 C# Db 1109 C# Db 8870
D 147 D 1175 D 9397
D# Eb 156 D# Eb 1245 D# Eb 9956
E 165 E 1319 E 10548
F 175 F 1397 F 11175
F# Gb 185 F# Gb 1480 F# Gb 11840
G 196 G 1568 G 12544
G# Ab 208 G# Ab 1661 G# Ab 13290
A 220 A 1760 A 14080
Bb 233 Bb 1865 Bb 14917
B 247 B 1976 B 15804
Octave 2 Octave 5 Octave 8
--------------- --------------- ---------------
C 262 C 2093 C 16744
C# Db 277 C# Db 2217
D 294 D 2349
D# Eb 311 D# Eb 2489
E 330 E 2637
F 349 F 2794
F# Gb 370 F# Gb 2960
G 392 G 3136
G# Ab 415 G# Ab 3322
A 440 A 3520
Bb 466 Bb 3729
B 494 B 3951
Octave 3 Octave 6
--------------- ---------------
C 523 C 4186
C# Db 554 C# Db 4435
D 587 D 4698
D# Eb 622 D# Eb 4978
E 659 E 5274
F 698 F 5587
F# Gb 740 F# Gb 5919
G 784 G 6271
G# Ab 831 G# Ab 6644
A 880 A 7040
Bb 932 Bb 7459
B 987 B 7902
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER D-1
APPENDIX D - Coding Pulldown Menu Systems
With this version of dBTools, you can program pulldown menu systems
with a selecting horizontal bar menu across the top for the main
categories, and pulldown vertical bar menus when the horizontal pad is
selected. When a vertical pulldown menu is visible, you can select the
adjacent vertical menu by pressing the right or left arrow key
(previous to this version, pressing the right or left arrow in a
vertical menu would just beep).
Alternatively you could use a "hotkey" to jump right into another
vertical menu without having to cycle through intervening options. The
ability to trap a hotkey also permits you to provide context sensitive
popup help windows while in the menu system (eg, upon pressing Alt-h or
something similar).
It's much easier to give a demonstration than to try to explain it in
English. The main demo menu is now coded in such a fashion, and the
the "Pulldown menu system" selection off the Menus option also illustrates
the new features. Also provided is a "skeleton" code module in the file
CLOSET.PRG.
Coding a pulldown menu system relies on two new dBTools features; the
ability for HMENU to act upon an initial bar choice without waiting for
a keystroke, and the ability for VMENU to trap and return FKey and
control key combinations (Note: "control key" refers to non-ASCII keys
such as the direction keys, function keys, Ins, Del, Home, End, PgUp,
PgDn, plus standard ASCII keys in combination with Cntrl or Alt; eg,
Alt-b or Cntrl-w). The scancodes that are returned by key combinations
are listed in Appendix E.
Coding HMENU with an initial choice of 0 will display the horizontal
bar menus, but with no options highlighted. The function will
immediately exit without pausing for a keystroke, and will return a
value of -1 in the parameter string:
HCHOICE = 0
mMENUSTR="9,"+STR(HCHOICE,2)+",0,0,7,1,1,7, Data Entry ;
, Reports , Utilities , Quit ,@"
CALL DBTOOLS WITH mMENUSTR
HCHOICE = VAL(mMENUSTR) && will return HCHOICE=-1
Use of blanks in the menu items can space the menu out more.
Coding HMENU with a NEGATIVE initial choice will draw the menu, high-
light the initial choice, exit the menu without pausing for a key-
stroke, and return a number which will be the absolute value of the
initial choice. For example, if the first line in the code segment
above was HCHOICE = -2, the menu would be drawn, 'Reports' would be
highlighted, the menu would be exited immediately without waiting for a
keystroke, and the last code line would return HCHOICE = 2.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER D-2
The second scenario above permits you to act upon control keys "lower
down" in your code to go through HMENU without having to manually
select options.
Secondly, VMENU, when defined with the Y option, will trap non-ASCII
control keys:
mKEY =ASC(SUBSTR(mMENUSTR,4,1))-1 && extract 1st scancode
mSCAN=ASC(SUBSTR(mMENUSTR,5,1))-1 && extract 2nd scancode
mCUROPT=ASC(SUBSTR(mMENUSTR,6,1)) && currently highlighted
&& option
Code segment:
VCHOICE = 1
DO WHILE VCHOICE<>0 && vmenu loop
CALL DBTOOLS WITH "21,3,1,5,6,20,14,1,1,1" && define window
mPARM="20,Y,"+STR(VCHOICE,2)+",3,14,0,2,Employees,Accounts,;
Transactions,Report Titles,@"
CALL DBTOOLS WITH mPARM
VCHOICE = VAL(mPARM)
DO CASE
CASE VCHOICE = 0 && ESC pressed
CASE VCHOICE = 1 && Employees selected
DO EMPDE
CASE VCHOICE = 2 && Accounts selected
DO ACCTDE
CASE VCHOICE = 3 && Transactions selected
DO TRANDE
CASE VCHOICE = 4 && Report Titles selected
DO RPTTTLDE
CASE VCHOICE = 99 && non-ASCII key pressed
* A special procedure to processing control keys pressed. The 3rd
* parm is the number of menu items, the last is the NAME of the
* hotkey processor.
DO TRAPIT WITH mPARM,HCHOICE,4,"HKPROC"
EXIT
ENDCASE
CALL DBTOOLS WITH "19,3" && unpop window
ENDDO && terminate VCHOICE loop
You'll have to experiment with VMENU's coordinate parameters to get it
to line up with the HMENU options.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER D-3
The above code module will handle the processing of the vertical pull-
down menus. There would be a similar block of code for each of the
HMENU options (ie, also one for Reports, Utilities, and Quit), nested
inside another DO CASE coming off of HMENU:
HCHOICE = 1
DO WHILE HCHOICE<>0
mMENUSTR="9,"+STR(HCHOICE,2)+",0,0,7,1,1,7, Data Entry ;
, Reports , Utilities , Quit ,@"
CALL DBTOOLS WITH mMENUSTR
HCHOICE = VAL(mMENUSTR)
DO CASE
CASE HCHOICE = 1
* VMENU code block as above
CASE HCHOICE = 2
* VMENU code block for Reports
CASE HCHOICE = 3
* VMENU code block for utilities
CASE HCHOICE = 4 .OR. HCHOICE = 0
* VMENU code block to choose Exit to Dos or to Dot Prompt
ENDCASE
ENDDO
What remains is the code for the TRAPIT procedure:
*|----------------------------------------------
PROCEDURE TRAPIT
PARAMETERS mPARMSTR,HCHOICE,mMAXVAL,mHOTKEY
mKEY=ASC(SUBSTR(mPARMSTR,4,1))-1
mSCAN=ASC(SUBSTR(mPARMSTR,5,1))-1
mCURVAL=ASC(SUBSTR(nPARMSTR,6,1))
DO CASE
CASE mSCAN = 75 && west
IF mCURVAL = 1
mRETVAL = mMAXVAL
ELSE
mRETVAL = HCHOICE - 1
ENDIF
CASE mSCAN = 77 && east
IF HCHOICE = mMAXVAL
mRETVAL = 1
ELSE
mRETVAL = HCHOICE + 1
ENDIF
* Trap for hot keys
CASE mSCAN = 35 && Alt-h
* you could write a routine for context sensitive help.
DO DISPHELP WITH HCHOICE,mCUROPT
mRETVAL = -HCHOICE
_______________________________
continued next page
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER D-4
......continued.....
OTHERWISE
* call another procedure to do hotkey processing. This enables
* you to use the same TRAPIT routine with different menus that
* use hotkeys.
IF mHOTKEY<>""
DO &mHOTKEY
ELSE
?? CHR(7)
mRETVAL = -HCHOICE
ENDIF
ENDCASE
HCHOICE = -mRETVAL
RETURN
*|-------------------------------------------------------------
PROCEDURE HKPROC && hotkey processor
PARAMETERS mKEY,mSCAN,HCHOICE
DO CASE
CASE mKEY=4 .AND. mSCAN=0 && Cntrl-d
mRETVAL=1
CASE mKEY=18 .AND. mSCAN=0 && Cntrl-r
mRETVAL = 2
CASE mKEY=21 .AND. mSCAN=0 && Cntrl-u
mRETVAL = 3
CASE mKEY=17 .AND. mSCAN=0 && Cntrl-q
mRETVAL = 4
OTHERWISE
mRETVAL = -HCHOICE
?? CHR(7)
ENDCASE
HCHOICE = -mRETVAL
RETURN
A full implementation of this type of menu structure is found in the
program files DBTMAIN.PRG and DBTPULDN.PRG, with some calls to procedures
in DBTPROC.PRG. Also, a "skeleton" code module which you can modify is
found in the file CLOSET.PRG.
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER
APPENDIX E - Scancode Values displayed as KEY,SCANCODE. Combinations
which do not work are marked xxxxx.
KEY Normal Shift Cntrl Alt
----- ------ ----- ----- -----
F1 0,59 0,84 0,94 0,104
F2 0,60 0,85 0,95 0,105
F3 0,61 0,86 0,96 0,106
F4 0,62 0,87 0,97 0,107
F5 0,63 0,88 0,98 0,108
F6 0,64 0,89 0,99 0,109
F7 0,65 0,90 0,100 0,110
F8 0,66 0,91 0,101 0,111
F9 0,67 0,92 0,102 0,112
F10 0,68 0,93 0,103 0,113
West 0,75 0,75 0,115 xxxxx
East 0,77 0,77 0,116 xxxxx
North 0,72 0,72 xxxxx xxxxx
South 0,80 0,80 xxxxx xxxxx
Home 0,71 0,71 0,119 xxxxx
End 0,79 0,79 0,117 xxxxx
PgUp 0,73 0,73 xxxxx xxxxx
PgDn 0,81 0,81 xxxxx xxxxx
Ins 0,82 0,82 xxxxx xxxxx
Del 0,83 0,83 xxxxx xxxxx
Note: letters without Alt or Cntrl are searched for a first
letter match in menus, beep if not found.
a xxxxx xxxxx 1,0 0,30
b xxxxx xxxxx 2,0 0,48
c xxxxx xxxxx ^C 0,46
d xxxxx xxxxx 4,0 0,32
e xxxxx xxxxx 5,0 0,18
f xxxxx xxxxx 6,0 0,33
g xxxxx xxxxx beep 0,34
h xxxxx xxxxx 8,0 0,35
i xxxxx xxxxx 9,0 0,23
j xxxxx xxxxx 10,0 0,36
k xxxxx xxxxx 11,0 0,37
l xxxxx xxxxx 12,0 0,38
m xxxxx xxxxx 13,0 0,50
n xxxxx xxxxx 14,0 0,49
o xxxxx xxxxx 15,0 0,24
p xxxxx xxxxx xxxxx 0,25
q xxxxx xxxxx 17,0 xxxxx
r xxxxx xxxxx 18,0 xxxxx
s xxxxx xxxxx xxxxx 0,31
t xxxxx xxxxx 20,0 0,20
u xxxxx xxxxx 21,0 0,22
v xxxxx xxxxx 22,0 0,47
w xxxxx xxxxx 23,0 0,17
x xxxxx xxxxx 24,0 0,45
y xxxxx xxxxx 25,0 0,21
z xxxxx xxxxx 26,0 0,44
dBTools - dBASE III+ Enhancement Tools
(c) 1990 BERNATH COMPUTER
APPENDIX E - Scancode Values displayed as KEY,SCANCODE
KEY Normal Shift Cntrl Alt
----- ------ ----- ----- -----
1 49,0 ! 33,0 xxxxx 0,120
2 50,0 @ 64,0 ^C 0,121
3 51,0 # 35,0 xxxxx 0,122
4 52,0 $ 36,0 xxxxx 0,123
5 53,0 % 37,0 xxxxx 0,124
6 54,0 ^ 94,0 30,0 0,125
7 55,0 & 38,0 xxxxx 0,126
8 56,0 * 42,0 xxxxx 0,127
9 57,0 ( 40,0 xxxxx 0,128
0 48,0 ) 41,0 xxxxx 0,129
` 96,0 ~ 126,0 xxxxx xxxxx
- 45,0 _ 95,0 31,0 0,130
= 61,0 + 43,0 xxxxx 0,131
[ 91,0 { 123,0 27,0 xxxxx
] 93,0 } 125,0 29,0 xxxxx
\ 92,0 | 124,0 28,0 xxxxx
, 44,0 < 60,0 xxxxx xxxxx
. 46,0 > 62,0 xxxxx xxxxx
/ 47,0 ? 63,0 xxxxx xxxxx
ENTER 13,0 13,0 10,0 xxxxx
ESC 27,0 xxxx xxxxx xxxxx
VMENU and HMENU return the parameter string as
"99 "+CHR(scancode)+CHR(highlighted)+CHR(0), which can be extracted
as follows:
choice = VAL(mMENUSTR) && will return 99 if an Fkey was
&& pressed, 0 if ESC, or selected
&& option number
IF choice = 99
mKEY = ASC(SUBSTR(mMENUSTR,4,1))-1
mSCAN = ASC(SUBSTR(mMENUSTR,5,1))-1
choice = ASC(SUBSTR(mMENUSTR,6,1))
ENDIF
The scancodes for an FKey/control key pressed during PAUSE and
GETKEY are returned in the first and second byte of the paramter
string:
mKEY=ASC(mPARM)-1
mSCAN=ASC(SUBSTR(mPARM,2,1))-1
APPENDIX F - dBTools REGISTRATION FORM
dBTools version 1.23
(c) 1990 BERNATH COMPUTER
Date ____/____/____
Name ___________________________________________
Address ___________________________________________
City, State, Zip ___________________________________________
Phone (____)________________ Ext _____
Company Name ___________________________________________
Where you obtained dBTools (BBS number, if applicable):
_______________________________________________________________
________ copies of dBTools with latest upgrade
disk at $25 each . . . . . . . . . . . . ____________
Each will receive its own serial number.
________ site license(s) at $40 (includes disk) ____________
Shipping and handling . . . . . . . . . ____________
Shipping is $1.50 for up to 3 disks.
We can send it COD for an additional
$5.00 COD charge.
============
TOTAL $
Make checks payable to BERNATH COMPUTER
and send to:
BERNATH COMPUTER
1821 Harding Court
Antioch, CA 94509
Thank you, and God Bless!
BERNATH COMPUTER / 1821 Harding Court / Antioch, CA 94509
dBTools 1.23 QUESTIONAIRE / SURVEY
I would like to get some feedback on the direction of dBTools, how you
came across it, etc. Please fill out this form and send it in. Thanks.
Name ___________________________________________
Address ___________________________________________
City/State/Zip ___________________________________________
Phone _______________________
Date _______________________
1. Where/how did you obtain your copy of dBTools (if from a BBS, please
give the BBS name and number. Include area code)?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
2. Do you write dBASE programs for your own personal use, for work, or
custom applications for others?
__________________________________________________________________
__________________________________________________________________
3. What are some of the dBASE applications you have written, or are
planning to write?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
4. What are some new features, changes, etc. you'd like to see incor-
porated into dBTools?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
5. Other general comments about dBTools:
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________