home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
clipper
/
grump14.arc
/
README.DOC
< prev
next >
Wrap
Text File
|
1988-12-03
|
74KB
|
1,814 lines
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
▒█ █
░▒█ GRUMPFISH LIBRARY VERSION 1.4 █
░▒█ Creative Tools for the Clipper Programmer █
░▒█ Copyright 1988 by Greg Lief █
░▒█ CompuServe ID 72460,1760 █
░▒█ Serial No. 0001 █
░▒█ █
░▒█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Greetings, Clipper programmer! The Grumpfish Library contains a number
of high quality, extremely useful pop-up desktop utilities and other
functions that you can integrate into your Clipper programs with
an absolute minimum of effort.
The pop-up applications include a full-featured calculator, phone
number/address database, notepad/word processor, calendar, fully user-
definable context-specific help screens, Mastermind game, and puzzle.
The functions include automatic generation of vertical and
horizontal bounce-bar menus, user-defined queries (filters),
exploding, shrinking, pop-up and drop-down boxes, a global
replacement capability that simulates the flexibility of the dBASE
dot prompt, and plenty of other useful things. Also included is a
musical library of various themes that you can stick into your
program to amuse yourself and/or annoy the end user.
In general, to use a Grumpfish application or function, you merely use
the command to call the function in your source code, then link your
application with GRUMP.LIB. Only the required code will be included
from the library file, thus eliminating unnecessary overhead.
*** IMPORTANT: The Grumpfish Library is written entirely in Clipper
using the Summer '87 version. If you are using an earlier version of
Clipper, some of the Grumpfish functions may not link properly because
they utilize some of the new Clipper functions. However, if you are a
registered Clipper owner and have not yet updated to Summer '87, what
are you waiting for? The speed advantages alone are worth it!
LICENSE INFORMATION
The Grumpfish Library is protected by U.S. Copyright law, and is
NOT "shareware" or public domain software. You are hereby granted
a limited license to make an evaluation copy for trial use on a
private, non-commercial basis for the express purpose of
determining whether the Grumpfish Library is suitable for your
programming needs.
At the end of this trial period, you should either register your copy
or discontinue using the Grumpfish Library in your Clipper programs.
Registration will entitle you to a comprehensive run-time royalty-
free license arrangement, at which time you can freely incorporate
any or all Grumpfish Library functions in your commercial programs.
You are encouraged to freely distribute copies of the entire Grumpfish
Library package, which consists of the archive file GRUMP14.ARC.
Please do not distribute the files in their de-archived form.
REGISTRATION
1. BENEFITS
If you find the Grumpfish Library useful in your Clipper programming
endeavors, you must register your copy. There are two levels of
registration, Landlubber and Captain, which entitle you to the
following benefits:
LANDLUBBER ($30)
1. The most current version of the Grumpfish Library delivered to
your home by the United States Postal Service, with your
personal registration number on this screen.
2. Run-time royalty-free license. In other words, you will be free to
integrate any or all functions of the Grumpfish Library into your
own Clipper applications without having to pay any royalty or fee
for doing so. You may also distribute or market any such
applications royalty-free.
3. Notification of future versions of the Grumpfish Library. I have
been averaging a new release about every six weeks for the last
four months, and, with sufficient user feedback, expect to continue
in this vein.
CAPTAIN ($60)
All Landlubber's benefits listed above, plus
4. The source code for all functions and applications in the Grumpfish
Library, written entirely in Clipper (Summer '87). The code is
well-documented, and is invaluable as a learning tool for beginning
and intermediate programmers. More advanced programmers will be
able to customize the applications and functions as desired.
5. Free telephone support (beginning in January 1989 -- see below)
Please bear in mind, however, that item 4) does NOT entitle you
to distribute or sell Grumpfish functions! This constitutes
a violation of the U.S. copyright on this program.
Grumpfish Library features can be customized to suit your company's
specific needs. Please contact me for more information.
Special user group registrations or site licenses are available.
Please write if you are interested.
2. HOW TO REGISTER
a. At the DOS prompt, type "COPY ORDER PRN" to print the registration
form. This form is a self-contained mailer, so you won't
have to bother with an envelope.
b. Mail the completed form with your check or money order for $30 or
$60 to:
Charles G. Lief
P. O. Box 17761
Salem, Oregon 97305
3. SUPPORT
At the moment, I am not offering telephone support, but I expect
to begin doing so for Level B registered users in January 1989.
In the meantime, however, I will be happy to answer all corres-
pondence sent to me via either U.S. Mail or CompuServe (ID 72460,
1760). You DO NOT have to be a registered owner to contact me;
if you have a particular problem or have stumbled across some
magnetic critter that snuck past me, I want to hear from you!
USER GROUPS/SHAREWARE DISTRIBUTORS
PC User Groups are welcome to add the Grumpfish Library to their
libraries under the following conditions:
1) it must be completely unmodified;
2) a diskette/copying fee of $5 or less is charged; and
3) this documentation file MUST be included.
I would appreciate notification that you have added Grumpfish
Library to your library.
If you have received the Grumpfish Library through either a user
group or a shareware distributor, please remember that the
diskette fee you paid DOES NOT constitute licensing the software,
and you are still obligated to register if you decide to use
Grumpfish Library features in your Clipper programming endeavors.
STARTING OUT
For convenience's sake, copy GRUMP.LIB to the same subdirectory where
CLIPPER.LIB and EXTEND.LIB are located.
USING THE GRUMPFISH LIBRARY
To use any of the Grumpfish applications or functions, you must first
link in the Grumpfish library (GRUMP.LIB). In addition, you will need
to link in Clipper's Extend library (EXTEND.LIB), because nearly
all of the Grumpfish Library functions call functions in this
library.
The following are examples of what you would enter at the DOS prompt
for the three most commonly used linkers (<yourfile> represents the
name of your main .obj file):
For PLINK86 linker: PLINK86 FI <yourfile> LIB GRUMP,EXTEND,CLIPPER
For the DOS linker: LINK <yourfile>,,,GRUMP + EXTEND + CLIPPER
For Borland's TLINK: TLINK <yourfile>,,,GRUMP EXTEND CLIPPER
Note that if your libraries are not located in the same subdirectory
where linking is being performed, you will have to add the drive
and/or path to prevent the linker from choking!
TABLE OF CONTENTS
POPCALC....... Pop-up calculator
POPPHONE...... Pop-up phone directory
POPDATE....... Pop-up calendar
POPSTOP....... Pop-up stopwatch
POPMM......... Pop-up Mastermind game
POPPUZ........ Pop-up logic puzzle
HELP/HELPDEV.. Pop-up user-defined help screens
POPNOTE....... Pop-up notepad
YES_NO()...... Display yes/no question and wait for response
ERR_MSG()..... Display error message and wait for keypress
CENTER()...... Centers a character string on specified row
WAITON()...... Display visual feedback for tedious processes
WAITOFF()..... Restore screen after using WAITON()
EXBOX()....... Exploding box
SHRBOX()...... Shrinking box -- opposite of EXBOX()
POPBOX()...... Pop-up box
DROPBOX()..... Drop-down box
SETFILT()..... Create pseudo-SQL query of any database file
BATCHREP().... Simulate dBASE dot prompt global replacement
MEMEDIT()..... Edit a memo field
MENUH()....... Display horizontal bounce-bar menu
MENUV()....... Display vertical bounce-bar menu
NET_USE()..... Opens files in multi-user environments
REC_LOCK().... Attempts to lock a record
FILELOCK().... Attempts to lock a file
ADD_REC()..... Attempts to APPEND BLANK to current file
HELPBROW().... Interactive help screen for data validation
PRINTOK()..... Tests for printer status and informs user if problem
DATEST()...... Returns blank spaces for empty dates
ISSTATE()..... For validating entry of state abbreviations
SPREAD()...... Display character string from the middle out
TTY()......... Move a character string continuously across the screen
PASS_CHK().... Get password from user
RAND()........ Returns a random number in the specified range
TIMEWORD().... Returns word describing the time of day (morning, etc.)
GL_VER()...... Returns version number of Grumpfish Library
BEATIT........ Plays the opening riff from "Beat It"
BORN2RUN...... Plays a verse and chorus from "Born To Run"
CHARGE........ Plays the venerable "Charge!" theme
HATDANCE...... Plays the Mexican Hat Dance
IPANEMA....... Plays the opening bars of "The Girl From Ipanema"
JEOPARDY...... Plays the theme from Final Jeopardy
DECKHALL...... Plays "Deck The Halls"
JINGLE........ Plays "Jingle Bells"
RUDOLPH....... Plays "Rudolph The Red-Nosed Reindeer"
POP-UP APPLICATIONS
1. CALCULATOR
a. Description and Usage:
This is a useful calculator that includes all the basic operators:
addition (+), subtraction (-), multiplication (*), and division (/).
But it also has some other goodies, including exponentation (^), a
paste function and a full-featured memory. Plus, whenever you press an
operator ('+', '-', '*', '/', or '^'), the previous number is shown
above the display window. This is handy for when you are processing a
list of numbers and forget where you were.
Active Keys:
'+' -- addition '-' -- subtraction
'*' -- multiplication '/' -- division
'^' -- exponentation 'C' -- clear current number
'E' -- clear entry (does not clear previously entered number in
pending operation)
'=' or Enter -- process operation Esc -- exit Calculator
b. Memory Functions:
To access memory functions, press "M", then one of the flashing
function keys. The function keys are:
'R' -- recall number stored in memory
'C' -- clear memory (reset to zero)
'+' -- add current number to number stored in memory
'-' -- subtract current number from number stored in memory
'*' -- multiply number stored in memory by current number
'/' -- divide number stored in memory by current number
The maximum value that can be stored in the calculator is
99,999,999,999.9999.
The paste function enables you to paste the current calculator value
into a pending READ by pressing a designated hot key (Ctrl-P is
suggested). PASTE CAVEAT: erratic results may occur if the number
of decimal places in the number to be pasted is larger than the
number of decimals in the memory variable or field. For example,
suppose that you have just used the calculator to derive the result
75.2877. You wish to paste this number into a memory variable
mTOTAL, which you are GETting with a picture template of '###.##'.
The probability is strong that this number will be stored
on-screen as 75.29 (although internally it will remain 75.2877).
c. Using the Calculator in your Clipper application:
There are two ways that you can make use of the calculator. The first
method is to use the SET KEY command to establish a "hot-key" so that
the user can pop up the calculator anywhere within the program. The
following lines added at the top of your program configures the F6 key
to serve as the hot key for the pop-up calculator and Ctrl-P as the hot
key for the paste function:
EXTERNAL popcalc && define external symbol for linker
PUBLIC paste_no && holds current calculator value for pasting
calckey = -5 && hot key will be function key F6
SET KEY calckey TO popcalc
SET KEY 16 to paste && Ctrl-P (optional)
If you want to use different keys as hot keys, please refer to your
Clipper manual for a list of INKEY() values.
The second method is to call the calculator directly. The following is
a sample menu including the calculator as a menu option:
PUBLIC paste_no
SET KEY 16 TO paste
|
|
|
@ 05,05 PROMPT "Data Entry"
@ 06,05 PROMPT "Reports"
@ 07,05 PROMPT "Calculator"
@ 08,05 PROMPT "Exit to Operating System"
MENU TO selection
DO CASE
CASE selection = 1
DO dataentry
CASE selection = 2
DO reports
CASE selection = 3
DO popcalc
CASE selection = 4
QUIT
ENDCASE
Although the second method may appeal to some of you, I highly
recommend using SET KEY so as to permit the user access to the
calculator from anywhere within the program.
2. PHONE DIRECTORY
a. Description:
This application allows the user to maintain a phone database with
names, addresses, and phone numbers of business and personal contacts.
It utilizes two files, PHONE.DBF and PHONE.NTX. You do not need to
create these files; the application automatically generates them if it
cannot find them in the specified subdirectory.
The user interface is a browse-style window. The user can view, add,
edit, and delete records from the phone database. You can instruct the
application to search a specific subdirectory for the database file by
initializing a memory variable named 'phonedir' with the value of the
desired directory (example: "C:\PHONE"). If 'phonedir' is not defined
in your program, the current directory will be used.
Active Keys:
A -- add a record to the database
E -- edit highlighted record
D -- delete highlighted record
Arrow keys -- scroll through the database
Esc -- exit the phone directory
F2 -- view/edit address information for the highlighted record
Pressing F2 allows the user to view and/or edit address information for
the highlighted person. A box containing that information will appear
in the middle of the screen. The user can enter information in these
fields as desired. They can then press Ctrl-W to save their edits, or
Esc to exit without saving. Either way, they will be returned to the
browse window.
b. Using the Phone Directory in your Clipper applications:
As with the calculator, there are two methods to choose from. The
first is to use SET KEY to establish a hot-key so that the user can pop
up the phone directory anywhere within the program. The following
lines added at the top of your program configures the F7 key to serve
as the hot key, and instructs the program to look for the phone
database in the subdirectory "C:\PHONE":
EXTERNAL popphone && define external symbol for linker
phonekey = -6 && hot key will be function key F7
phonedir = 'C:\PHONE' && search directory for phone.dbf
SET KEY phonekey TO popphone
If you want to use a different hot key for the phone directory, please
refer to your Clipper manual for a list of INKEY() values.
The second method is to call the phone directory directly. Refer to
the Calculator discussion for a sample menu. Once again, I highly
recommend using the SET KEY method.
3. CALENDAR
a. Description and Usage:
This is a pop-up calendar that displays the current month and the first
two weeks of the next month. The current day will blink. Press any
key to exit the calendar.
b. Using the Calendar in your Clipper applications:
As with the other applications, there are two ways to utilize the
calendar. The first is to use SET KEY to establish a hot-key so that
the user can pop up the calendar anywhere within the program. The
following lines added at the top of your program configures the F8 key
to serve as the hot key for the calendar:
EXTERNAL popdate && define external symbol for linker
datekey = -7 && hot key will be function key F8
SET KEY datekey TO popdate
If you want to use a different hot key for the calendar, please refer
to your Clipper manual for a list of INKEY() values.
The second method is to call the calendar directly. Refer to the
Calculator discussion for a sample menu. However, I recommend using
SET KEY.
4. STOPWATCH
a. Description and Usage:
Here is a pop-up stop watch that logs minutes, seconds, and hundredths
of seconds. You never know when you might need one. Operation is
simple: press the space bar to start and stop. Press Esc to quit.
b. Using the Stopwatch in your Clipper applications:
As with the other applications, there are two ways to utilize the
stopwatch. The first (and best) is to use SET KEY to establish a hot-
key so that the user can pop up the stopwatch anywhere within the
program. The following lines added at the top of your program
configures the F5 key to serve as the hot key for the stopwatch:
EXTERNAL popstop && define external symbol for linker
stopkey = -4 && hot key will be function key F5
SET KEY stopkey TO popstop
If you want to use a different hot key for the stopwatch, please refer
to your Clipper manual for a list of INKEY() values.
The second method is to call the stopwatch directly. See the
Calculator section above for a sample menu. Once again, however, I
recommend using SET KEY.
5. HELP SCREENS
a. Description and Usage
Context-specific pop-up help screens add enormous user-friendliness to
any program. With the Grumpfish Library, it is a breeze to create your
own fully-customized help screens.
There are two stages to the help screen process: development, and
post-development (release). The fundamental difference between the
two stages is that the help screens can only be created during
the development stage.
i. Development Stage
To develop the help screens, add these two lines at the top of your
program:
EXTERNAL helpdev && declare symbol for linker
SET KEY 28 TO helpdev && redefine F1 key
Next, recompile and link your program, because the actual creation of
the help screens takes place interactively from within your program.
Then run the program.
You may create a help screen for any wait state. Wait state commands
include ACCEPT, INPUT, MENU TO, MEMOEDIT(), READ, and WAIT. When you
are at a wait state where you wish to have a help screen, press F1. If
this is the first time you have called the HELP function, the program
will take a few seconds to initialize the HELP database. Three files
will be created in the default directory: HELP.dbf, HELP.dbt, and
HELP.ntx. These files should not be deleted! If you do delete them,
any previously-created help screens will have to be recreated.
Assuming that you have not already created a help screen for this
particular wait state, you will get a help screen with the message:
No help text defined...
Press F2 to create, any other key to return
Press F2 to create the help screen text, then type it in exactly as you
wish it to appear. Once you are satisfied with the text, press Ctrl-W
to save it. You will then be prompted to enter the coordinates where
you wish the help screen box to appear, and the title for this help
screen. The title will be centered on the top row of the box.
Once you have finished entering these items, you will be asked to
select a box outline from the six that will appear in the middle
of the screen. When you select a box, a color palette containing all
of the 128 possible foreground/background combinations will be drawn
near the bottom of your screen. You will then be prompted to enter
the desired color number for (a) the box outline, (b) the box title,
and (c) the text.
When you have defined your help screen, it will be painted with your
desired characteristics. You will then be asked to confirm that you
are satisfied with its appearance. If you aren't, it is a simple
matter to go back and change it until you ARE satisfied. All values
that you enter will be retained, which means that you could go back
and quickly change the text color, for example, without having to
re-enter all of the other items.
The next time that you (or an end user) presses F1 at this point
in the program, your fully-customized help screen will appear to
guide them through the magnetic wilderness. The cursor keys can
be used to scroll through it, or you may print the entire help
text by pressing Alt-P.
There is also a hidden function that enables you to edit the text
and attributes of any help screen. Press F1 to pop up the help
screen, then press Alt-E (for Edit). You are then free to edit it
as you see fit. Press Ctrl-W to save your text edits. You will
then be prompted to enter the values for the various box attributes
similarly to when you created the help screen. This function is
"hidden" because of the strong probability that most of your programs
will be used by other people.
ii. Post-Development (Release) Stage
When you are fairly certain that all the necessary help screens
have been created, you will probably want to 'lock' the program in
such a manner that your users cannot run amuck creating their own
help screens. To create such a lock, replace the two lines you
added previously:
EXTERNAL helpdev && declare symbol for linker
SET KEY 28 TO helpdev && redefine F1 key
with the following line:
EXTERNAL help && declare symbol for linker
Then recompile and link your program. Everything will be the same,
except that your users will be powerless to create their own help
screens. You will also notice that the .EXE file will be smaller
by approximately 4,000 bytes. This is because the routines for
customizing the appearance of the help screens are no longer
necessary.
If you or your end users decide that creation of further help
screens is necessary, you can always switch back to HELPDEV.
Thanks to Bill Altman of Hampton Bays, NY for suggesting increased
flexibility with the layout and color of these help screens.
6. NOTEPAD / WORD PROCESSOR
a. Description and Usage:
Developers and end users alike will benefit from this snazzy
pop-up notepad. The heart of the notepad is Clipper's MEMOEDIT(),
so all of that function's basic Wordstar-type commands are available
herein (a full listing of these commands can be found in your Clipper
manual). However, I have added a number of useful mnemonic
commands, which are based on the following Alt-key combinations:
Alt-A (A)ppend a file to current file and continue
Alt-G (G)oto line number Alt-H (H)elp screen
Alt-I (I)nsert line Alt-K (K)ill current line
Alt-L page (L)ength for printing Alt-M change (M)argins
Alt-N edit (N)ew file Alt-P (P)rint file
Alt-Q (Q)uit but save edits Alt-R search and (R)eplace
Alt-S (S)ave file & continue Alt-T (T)oggle wordwrap on/off
Alt-W (W)rite to new file Alt-X e(X)it without saving
Alt-Y change director(Y)/wildcard
EDIT WINDOW/STATUS LINE: when you enter the notepad, the edit
window takes up nearly the full screen. There is a status line at
the bottom, which displays the name of the file being edited (sans
directory), the current line and column position of the cursor,
the left and right margins, and the status of wordwrap and insert
modes (displayed when active as "<Wrap>" and "<Ins>", respectively.)
CURRENT DIRECTORY/WILDCARD - the notepad gives you the ability to
change the working directory and/or filemask at any time. When
you first enter the notepad, the current directory will be set to
the default DOS directory, and the wildcard will be set to '*.*'.
If you would like to change either the directory where the notepad
looks for files or the wildcard used (e.g., "*.TXT", "*.PRG"),
press Alt-Y and enter the new information. You do not have to
enter slashes in front or back of the directory name UNLESS you
include a wildcard. For example, to change the current directory
to "\GRUMP\", you need only enter "GRUMP". However, if you want
the notepad to look for all the .PRG files in subdirectory
\GRUMP\, you must enter "\GRUMP\*.PRG".
If you enter just the wildcard, the current directory will remain
unchanged. If you enter a directory name only, the wildcard will
be reset to "*.*". If you press Enter without typing in anything,
neither the current directory nor the wildcard will be changed.
Examples: let's assume that your application is in a subdirectory
named \WORKSTUF. The initial current directory/wildcard will be
set to "\WORKSTUF\*.*". If you press Alt-Y and enter "*.PRG <CR>",
the directory/wildcard will be changed to "\WORKSTUF\*.PRG". If
you wish to change to the \GRUMP subdirectory, press Alt-Y and
enter "GRUMP <CR>". The directory/wildcard will then be changed
to "\GRUMP\*.*". Suppose you then want to look at only the .PRG
files starting with the letter P in the directory \WORKSTUF\DEVEL.
You would press Alt-Y again, and enter "\WORKSTUF\DEVEL\P*.PRG".
To retain the current directory and wildcard, you may declare
PUBLIC variables CURR_DIR and WILDCARD before calling the notepad.
This feature allows you to exit the notepad, and return later
without having to reset the directory and wildcard. You may also
wish to initialize these variables to suit your specific needs
(see the example below).
FILENAMES: when you press Alt-N to edit a new file or Alt-W to
write to another file, a scrolling window will appear containing
all files that match the current directory and wildcard mask.
The directory and wildcard mask will be shown at the top of this
window for reference. To select a file, move the highlight bar
to it and press Enter. To create a new file, select the option
'NEW FILE', then enter the filename. Pressing Esc will abort the
file selection process.
If you attempt to write to a file that already exists, or append
from a file that does not exist, you will get an error message to
that effect.
To retain the working filename, declare a PUBLIC variable named
NOTEFILE before calling the notepad. This feature allows you to
edit a file, exit the notepad, and return to the notepad later to
find the same file waiting for you. You may also wish to
initialize this variable to the name of the default file for
editing (the internal default is "TEMP").
INSERT and WORDWRAP: the start-up values for these modes is on.
They may toggled off and on at any time by pressing Insert and
Alt-W, respectively. The status of these modes appears at the right
side of the status line.
MARGINS: the start-up margins are 1 and 78. You can change these
at any time by pressing Alt-M and entering the desired values.
When you change the margins, the on-screen display will adjust to
reflect the new margins. You may use larger values for the right
margin than would appear on the 80-column screen. In such instances,
you should toggle wordwrap off and scroll to the right to display
text beyond the on-screen right margin. The current values of the
margins appears on the status line.
PAGE LENGTH: the start-up page length for printing is 60 lines. You
can change this at any time by pressing Alt-L.
SEARCH AND REPLACE: you can search and replace for all or for only
a specific number of occurrences of a character string. When you
press Alt-R, you will be prompted first to enter the search string,
then the replacement string. You will then be asked if you want to
replace all occurrences of the search string. If you answer 'N',
you will be prompted to enter the number of occurrences to replace.
Please note that the search begins at the top of the file and
continues either to the end of the file or until the specified
number of occurrences have been replaced.
PRINTING: you may print the current file at any time by pressing
Alt-P. Printing may be aborted at any time by pressing Esc. The
format of the printed page is determined by the current settings
of the margins and page length.
You may send a set-up string to the printer by defining a character
variable named SETUP_STR before calling the notepad. Similarly,
you may send a reset escape sequence after printing is complete
by defining a character variabled named RESET_STR. You may also
specify that a header be printed at the top of each page by
declaring a public variable NOTEHEAD before calling the notepad.
This one-line header will contain the filename (left-justified),
the system date (centered), and the page number (right-justified).
See below for examples of how to use these features.
b. Using the Notepad in your Clipper applications:
As with the other pop-ups, there are two ways to utilize the notepad.
The first and best is to use SET KEY to establish a hot-key so that
the user can pop up the notepad from anywhere within the program.
The following lines added at the top of your program configures the F4
key to serve as the hot key for the notepad.
EXTERNAL popnote && define external symbol for linker
notekey = -3 && hot key will be function key F4
SET KEY notekey TO popnote
The following example goes several steps further by establishing the
necessary variables to: (a) activate header printing (NOTEHEAD);
(b) send a set-up string before printing (SETUP_STR); (c) send a
reset sequence after printing is complete (RESET_STR); and (d) retain
the working filename, current directory, and wildcard upon exiting
the notepad (NOTEFILE, CURR_DIR, WILDCARD). The hypothetical user
will only need to edit files with the .TXT extesion, so WILDCARD is
set to '*.TXT'. CHR(15) is a common escape sequence used to activate
compressed (reduced) print, and the CHR(18) sequence is commonly
used to de-activate compressed print, so I have used these in my
example.
EXTERNAL popnote && define external symbol for linker
PUBLIC notehead,notefile,curr_dir,wildcard,setup_str,reset_str
setup_str = chr(15)
reset_str = chr(18)
wildcard = '*.TXT'
notekey = -3 && hot key will be function key F4
SET KEY notekey TO popnote
If you want to use a different hot key for the notepad, please refer
to your Clipper manual for a list of INKEY() values.
The second method would be to call the notepad directly. Please
refer to the Calculator section above for a sample menu. However,
I once again strongly recommend using SET KEY for maximum flexibility.
Special thanks to Jim Barcus of Moundsville, WV for his advice on
the notepad.
7. MASTERMIND*****
a. Description and Usage:
Mastermind is a diversion when the user's brain needs a good workout!
It is based on the logic board game by Pressman Corporation.
The computer selects four colored pegs and arranges them in a specific
sequence. The player's objective is to determine both the color and
position of the four pegs by making educated guesses and analyzing the
clues that the computer dispenses after each guess. These clues are:
one black marker for every peg that matches in both color and location;
and one white marker for every peg that is correct in color but not
location. An average game will take from eight to ten guesses. To
choose a color, the user moves the highlight bar to the desired color
and presses Enter. The user must choose colors from left to right. If
the user wants to quit in the middle of a game, they may do so by
pressing Esc instead of selecting a color. The program keeps track of
the guesses & clues on the right side of the screen so that the player
can refer back to them.
b. Using Mastermind in your Clipper applications:
As with the other applications, there are two ways to utilize
Mastermind. The first is to use SET KEY to establish a hot-key so that
the user can pop up Mastermind from anywhere within the program. The
following lines added at the top of your program configures the F9 key
to serve as the hot key for Mastermind:
EXTERNAL popmm && define external symbol for linker
mmkey = -8 && hot key will be function key F9
SET KEY mmkey TO popmm
If you want to use a different hot key for Mastermind, please refer to
your Clipper manual for a list of INKEY() values.
The second method is to call Mastermind directly. Refer to the
Calculator discussion for a sample menu. However, SET KEY is highly
recommended.
8. PUZZLE
a. Description and Usage:
Puzzle is the four by four square puzzle you had when you were a kid.
Fifteen of the squares are filled with the numbers 1-15, and it is up
to the player to arrange these in order like so:
┌───┬───┬───┬───┐
│ 1 │ 2 │ 3 │ 4 │
├───┼───┼───┼───┤
│ 5 │ 6 │ 7 │ 8 │
├───┼───┼───┼───┤
│ 9 │10 │11 │12 │
├───┼───┼───┼───┤
│13 │14 │15 │ │
└───┴───┴───┴───┘
To move, the player types in the number of the piece they wish to move.
The program will not allow them to cheat. Good luck - this can be
exasperatingly difficult!
b. Using the Puzzle in your Clipper applications:
As with the other applications, there are two ways to utilize the
puzzle. The first is to use SET KEY to establish a hot-key so that
the user can pop it up from anywhere within the program. The
following lines added at the top of your program configures the F10 key
to serve as the hot key for the puzzle:
EXTERNAL poppuz && define external symbol for linker
puzkey = -9 && hot key will be F10
SET KEY puzkey TO poppuz
If you want to use a different hot key for the puzzle, please refer to
your Clipper manual for a list of INKEY() values.
The second method is to call the puzzle directly. Refer to the
Calculator discussion for a sample menu. However, SET KEY is highly
recommended.
9. USING MULTIPLE POP-UP APPLICATIONS
If you would like to integrate more than one of these pop-up
applications into your program, use the following code at the top of
your program:
EXTERNAL help,popcalc,popphone,popdate,popmm,poppuz,popstop,popnote
notekey = -3 && F4 = hot key for notepad
stopkey = -4 && F5 = hot key for stopwatch
calckey = -5 && F6 = hot key for calculator
phonekey = -6 && F7 = hot key for phone directory
phonedir = 'C:\PHONE' && search directory for phone.dbf
datekey = -7 && F8 = hot key for calendar
mmkey = -8 && F9 = hot key for Mastermind
puzkey = -9 && F10= hot key for puzzle
SET KEY notekey TO popnote
SET KEY stopkey TO popstop
SET KEY calckey TO popcalc
SET KEY phonekey TO popphone
SET KEY datekey TO popdate
SET KEY mmkey TO popmm
SET KEY puzkey TO poppuz
However, if you incorporate all of the pop-up applications into your
program, you might never get any work done!!
FUNCTIONS
1. YES_NO()
This function displays a box with your message in it, and pauses
program execution until the user presses either 'Y' or 'N'. It returns
a logical value: true if the user pressed 'Y', or false if the user
pressed 'N'. The syntax is:
YES_NO(<message 1>[,<message 2>])
where <message 1> and <message 2> are the messages you wish to have
displayed. <Message 2> is optional.
Sample use of YES_NO:
kill_it = YES_NO('WARNING: Record will be deleted','Shall I continue')
IF kill_it
DELETE
SKIP -1
ENDIF
Note that the function automatically adds "? (Y/N)" to your last
message. For example, in the sample above, the following would be
displayed:
WARNING: Record will be deleted
Shall I continue? (Y/N)
2. ERR_MSG()
This function displays a box with your error message in it, along with
several choice beeps, and pauses program execution until the user
presses any key. It does not return a value. The syntax is:
ERR_MSG(<message>)
where <message> is the message you wish to display (not too
insulting, please!).
Sample use of ERR_MSG:
SEEK mVAR
IF .not. found()
ERR_MSG('That record was not found')
ENDIF
3. CENTER()
You will probably make frequent use of this function. It centers
character strings, either on the screen or the printer, at the row you
specify. Syntax is:
CENTER(<row>,<string>,[<length>])
Required Parameters:
<string> is the character string or expression to be centered.
<row> is a numeric expression representing the row on which to
center the string.
Optional Parameters:
<length> is a numeric expression representing the length of a row
(default length is 80 for screen displays, but you may use values
of up to 255 when printing wide reports).
Thanks to Jeanne Nerwinski of Durham, NC for the <length> parameter.
Sample usage of CENTER:
CENTER(0,'Change Order Data Input Screen')
CENTER(1,'WACKY WIDGETS MONTHLY PROFIT ANALYSIS',132)
4. WAITON() and WAITOFF()
This function is useful to keep the user of your application apprised
of time-consuming operations, such as printing a report, instead of
letting them stare at a blank screen and wonder what (if anything) is
going on.
First, call WAITON(), which displays a box with your message in it.
The syntax is:
WAITON([<message>])
where <message> is the message you wish to display. Note that if you
do not pass a message, WAITON() will assume that you are about to print
a report and will display the message "Now printing... please wait".
When the operation is complete, use WAITOFF() to refresh the screen.
The syntax is:
WAITOFF()
This will restore the screen to its original state.
Sample usage of WAITON and WAITOFF:
USE Sales
WAITON('Rebuilding index files... please wait')
INDEX ON lname TO Customer
INDEX ON date TO Saledate
INDEX ON inv_code TO Item
WAITOFF()
5. EXBOX()
Exploding boxes add enormous pizzaz to your color applications. The
syntax is as follows:
EXBOX(<top>,<left>,<bottom>,<right>,<box type>,<delay>,[<fill>])
Required Parameters:
<top> is an integer numeric representing the top row of the box.
<left> is an integer numeric representing the leftmost column of the box.
<bottom> is an integer numeric representing the bottom row of the box.
<right> is an integer numeric representing the rightmost box column.
<box type> is an integer numeric between 1 and 5, and represents the
type of box desired. The choices are:
Box Type Box String Used
1 ╔═╗║╝═╚║
2 ┌─┐│┘─└│
3 ╒═╕│╛═╘│
4 ╓─╖║╜─╙║
5 █▀███▄██
6 (no border)
The box string forms the box in the same fashion as with Clipper's
"@...BOX" command. The box is drawn using this string starting from
the left hand corner and proceeding clockwise. If you need more
information on this, please refer to your Clipper manual.
<delay> is an integer numeric between 1 and 100, and is used to delay
the 'explosion'. The larger the delay, the longer the box drawing
operation will take. I recommend using values between 1 and 10, but
you should experiment with this.
Optional Parameter:
<fill> is a character string to use as the fill character. If the
length of the character string passed is greater than one, only
the leftmost character will be used. If this parameter is not
specified, the fill character will be chr(32).
Sample usage:
EXBOX(11,28,13,51,2,5)
@ 12,30 SAY 'Enter your ID:'
@ 12,46 GET mID PICTURE 'XXXX'
READ
When using a monochrome monitor, an exploding box will not have any
noticeable effect.
6. SHRBOX()
What good are exploding boxes without shrinking boxes? Now you can
shrink that box you just exploded onto the screen back into
nothingness. Here's the syntax:
SHRBOX(<top>,<left>,<bottom>,<right>,<delay>,[<color>])
The first five parameters are identical to their namesakes in
EXBOX().
<color> is an optional character string parameter specifying the
color you wish to use to blank out the previous box. If not
passed, the current color setting will be used.
What SHRBOX() does is blank out the area marked by the speified
coordinates from the outside in, exactly opposite the method used
by EXBOX().
Sample usage:
(with the color parameter)
SET COLOR TO +w/b
EXBOX(11,17,13,62,2,5)
@ 12,19 SAY 'This box will self-destruct in two seconds'
INKEY(2)
SHRBOX(11,17,13,62,2,'w/n')
(without the color parameter)
SET COLOR TO +w/b
EXBOX(11,17,13,62,2,5)
@ 12,19 SAY 'This box will self-destruct in two seconds'
INKEY(2)
SET COLOR TO w/n
SHRBOX(11,17,13,62,2)
As with the exploding box, a shrinking box will have no noticeable
effect with monochrome monitors.
7. POPBOX()/DROPBOX()
Surely you don't want to restrict yourself to exploding and
shrinking boxes. Toss in a pop-up or drop-down box here and there
to keep the users on their toes. Syntax:
POPBOX / DROPBOX(<top>,<left>,<bottom>,<right>,<delay>)
The first five parameters are identical to their namesakes in
EXBOX() and SHRBOX().
The pop-up box will be drawn from the bottom up, whereas the drop-
down box will be drawn from the top down.
Sample usage:
POPBOX(5,5,23,55)
@ 14,8 SAY 'This box rose like a phoenix from the ashes!'
DROPBOX(1,60,11,79)
@ 5,63 SAY 'This box fell'
@ 6,63 SAY 'like pennies'
@ 7,63 SAY 'from heaven!'
(feel free to substitute cliches of your own choosing)
Unlike the exploding and shrinking boxes, pop-up and drop-down
boxes will be effective on monochrome monitors.
8. SETFILT()
This function allows you to simulate SQL (structured query language)
by establishing a query condition (or filter) for selectively printing
or displaying records. The syntax is hardly complex:
SETFILT()
SETFILT() returns a logical value. The return value is true (.T.) if
there are records found in the current database matching your query
condition, false (.F.) if there are not.
SETFILT() will display all of the field names of the current database
file. First, you move the highlight bar to the desired field and
presses Enter to add it to the query condition. You then select the
desired operator (equal to, less than, greater than, less than or equal
to, greater than or equal to, not equal to), and then the desired value
for that field. [For subsequent additions to the query condition, you
will be asked to select a logical (Boolean) operator (AND/OR)]. Bear in
mind that AND has precedence over OR when evaluating the query
expression. For example:
DATE=CTOD('05/01/81') .and. COST=50.00 .or. ITEM='widget'
will display all records with either (1) a date of 05/01/81 and a cost
of 50.00, or (2) item 'widget'. If you need more clarificationon
logical (Boolean) operators, please refer to your Clipper manual for
enlightenment.
As you add items to the query condition, it will be updated on the
screen so you can keep track of where you are.
When you are finished establishing your query condition, press Esc to
return to the calling program.
Sample Usage:
USE Sales
IF setfilt()
DISPLAY ALL
SET FILTER TO
ENDIF
RETURN
9. BATCHREP()
BATCHREP() allows the user to do global replaces within your program,
in a similar fashion to the REPLACE command at the dBASE dot prompt.
This function is invaluable for data-intensive applications.
The syntax consists of the following line:
BATCHREP()
There is no return value.
BATCHREP() will display all of the field names of the current database
file. First, you select the field yoiu wish to replace by moving the
highlight bar to that field and pressing Enter. You will then be
prompted to enter the new value for that field. Use dBASE III syntax;
if you want to see examples, press Alt-H. If the replacement field is
character type, you will not be permitted to replace it with a value
longer than the field's length. If the replacement field is logical
type, you must replace it with either .T. (True) or .F. (False),
logically enough.
After entering the new value, you then select the field or fields to
define the replacement scope. (If you want to unconditionally replace
all records, hit Esc to begin the replacement.) If you do select a
field, you first select an operator (equal to, greater than, less than,
etc.), and then enter a value for that field. As you add to the
replacement scope, it will be updated near the bottom of the screen.
You can use as many fields as you wish; for each subsequent field,
you will be asked to select a logical (Boolean) operator (AND/OR)].
See SETFILT() above for an example of logical operators.
When you are finished establishing the replacement scope, press Esc to
begin the replacement. If the field being REPLACEd is a key field in
any open index, you will be prompted to that effect. In this instance,
the replacement will take slightly longer, because the index fields
will have to be rebuilt after the replacement. When the replacement is
finished, the number of records replaced will appear in the center of
the screen for reference.
Sample Usage:
USE Sales
batchrep()
10. MEMEDIT()
This permits easy editing of memo fields. The syntax is:
MEMEDIT(<mfield>,[<t>,<l>,<b>,<r>][,<msg>])
Required Parameter:
<mfield> is a character string representing the name of the memo field
to be edited.
Optional Parameters:
<t>, <l>, <b>, <r> are all numeric expressions representing the
box coordinates (top, left, bottom, right, respectively). Default
box coordinates are 5,10,19,69.
<msg> is a character string to be centered at the top of your box.
The active keys during MEMEDIT are exactly the same as those in the
Clipper function MEMOEDIT(). Please refer to your manual for more
specifics.
Sample Usage:
USE Letters
MEMEDIT('text',10,20,15,59,'<< Edit Letter >>')
RETURN
11. MENUH()
This function allows you to easily paint a horizontal Lotus-style
light-bar menu on the screen. The syntax is:
MENUH(<row>,<col>,<spc>,<prompts>[,<messages>,<color>])
Required Parameters:
<row> is a numeric expression representing the row at which to display
the light-bar menu.
<col> is a numeric expression representing the starting column for the
light-bar menu.
<spc> is a numeric representing the desired spacing between menu
entries.
<prompts> is a character string containing all of the prompts for the
menu. These prompts must be separated by dollar signs.
Optional Parameters:
<messages> is a character string containing any desired messages
corresponding to the prompts. Like the prompts, the messages must
be separated by dollar signs. NOTE: You must SET MESSAGE in your
program before calling MENUH(), or your messages will not be
displayed!
<color> is a character string used to set the menu color. If this
parameter is not passed, white on black will be used for the
unselected options and inverse will be used for the light bar.
Return Value:
MENUH() returns a numeric value representing the selected menu option.
For example, if the user pressed 'D' in the sample below the return
value would be 1.
Sample usage:
sel=MENUH(23,5,4,'Data Entry$Reports$Previous Menu$','','+w/b,+w/n')
DO CASE
CASE sel = 1
DO data
CASE sel = 2
DO reports
OTHERWISE
RETURN
ENDCASE
12. MENUV()
This function will paint a vertical bounce-bar menu on the screen.
First, you must define an array containing the desired menu options
(and corresponding messages, if desired). If you wish to have
messages, you must separate the menu option from the message with a
dollar sign. Also, be sure to SET MESSAGE before calling MENUV().
The syntax for this function is:
MENUV(<array>[,<title>,<box type>,<box color>,<title color>])
Required Parameter:
<array> is a character string representing the name of the array that
contains the menu options.
Optional Parameters:
<title> is a character string representing the menu title.
<box type> is an integer between 1 and 12 corresponding to the
type of box you wish to use. Box types 1-4 are listed below:
Box Type Box String Used
1 ╔═╗║╝═╚║
2 ┌─┐│┘─└│
3 ╒═╕│╛═╘│
4 ╓─╖║╜─╙║
5 █▀███▄██
Boxes 6-10 and 11-15 are identical to boxes 1-5, except that 6-10 will
have an additional drop shadow (simulating a three-dimensional effect)
and 11-15 will have two drop shadows for super-duper 3-D.
<box color> is a character string containing the color to use for
the box. The default color is white on black for unselected
options and inverse (black on white) for the bounce bar.
<title color> is a character string containing the color to use
for the menu title. The default is white on black.
Return Value:
MENUV() returns a numeric value representing the selected menu option.
For example, if the user pressed 'Q' in the sample below the return
value would be 4.
Sample usage:
DECLARE mainmenu[4]
mainmenu[1]='Maintain Data$Add and edit information'
mainmenu[2]='Output Reports$Share your information'
mainmenu[3]='Utilities$Select printer, reindex files'
mainmenu[4]='Quit$Exit to DOS'
sel=MENUV(mainmenu,'Main Menu',11,'+w/rb,+w/n','+w/b')
DO CASE
CASE sel = 1
DO maintdata
CASE sel = 2
DO reports
CASE sel = 3
DO utility
OTHERWISE
RETURN
ENDCASE
13. NET_USE()
This function and the two that follow are primarily for multi-user
applications. If you have any questions about the basics of
networking, I suggest that you refer to either the Clipper manual
or the Spring 1987 issue of "Nantucket News", which provides an
excellent tutorial.
NET_USE() will open a specified database in either exclusive or
shared mode, along with up to eight corresponding index files.
The syntax is:
NET_USE(<filename>,<excl_use> [,<index1>,<index2>,...<index8>]
Required Parameters:
<filename> is a character string representing the name of the
database file to be opened.
<excl_use> is a logical expression representing the desired mode:
True (.T.) for exclusive, False (.F.) for shared.
Optional Parameters:
<index1>...<index8> are character strings representing the names
of the index files to be opened.
Return Value:
NET_USE() returns a logical value: True (.T.) if the file was
opened successfully, or False (.F.) if it was not.
If NET_USE() is unable to open the file, the user will be asked if
they wish to wait for it to become available. If not, the return
value will be False. If they do decide to wait, they will be
entertained by an intriguing screen display. They may abort the
wait at any time by pressing Esc (which will then cause the
function to return False).
This function also provides aural feedback to the user, so that if
they want to wait for the file, they do not necessarily have to
remain glued to the screen. When the file becomes available, the
Charge theme will be played, which is sure to get a Pavlovian
response from your users!
You will note the absence of explicit selection of work areas.
NET_USE() takes advantage of the Clipper "SELECT 0" command to
automatically select the next available work area.
WARNING: You must SET EXCLUSIVE OFF prior to calling this
function. If you do not, NET_USE() will attempt to open all files
exclusively, which will give you a terrible headache.
Sample Usage:
IF ! NET_USE('customer',.f.,'cust1','cust2')
RETURN
ENDIF
** code to maintain customer file
|
|
IF ! NET_USE('customer',.t.,'cust1')
RETURN
ENDIF
** code to print customer reports
14. REC_LOCK()/FILELOCK()
These two functions are crucial in any multi-user system.
Obviously enough, REC_LOCK() is used to lock records, while
FILELOCK() locks files. The syntax is simple:
REC_LOCK() / FILELOCK()
Required Parameters:
None.
Return Value:
Both functions return logical values: True (.T.) if the lock was
successful, or False (.F.) if unsuccessful.
If the locks are initially unsuccessful, the user will be given
the option to wait for availability in the same fashion as with
NET_USE(). Likewise, a dazzling screen will keep them amused
while they wait, and the Charge theme will be played when the lock
is finally successful.
Sample Usage:
IF REC_LOCK()
REPLACE name WITH mname, address WITH maddress
ENDIF
IF FILELOCK()
DO reports
ENDIF
15. ADD_REC()
This function is for APPENDing BLANK records to a database in a
multi-user system. The syntax is:
ADD_REC([<wait time>])
Optional parameter <wait time> is a numeric expression
representing the number of seconds to wait for the APPEND BLANK to
be successful. If this parameter is not passed, the function will
loop until either the APPEND BLANK is successful or the user
presses Esc.
Return Value:
ADD_REC() returns a logical value: True (.T.) if the APPEND BLANK
is successful, or False (.F.) if it did not succeed within the
specified time. Please note that it is highly unlikely that this
function will ever return False, except in the rare event that two
users have attempted to APPEND BLANK to the same database at
precisely the same time.
16. HELPBROW()
Most of us have written at least one program that utilizes small
"look-up" databases containing codes relating to more verbose
descriptions. Typical data entry for such fields in the primary
database would involve using a VALID() clause, in which you seek
the value against the look-up database and return a value of True
if it is found. This arrangement is quite workable as is, but
what if the user enters an invalid entry? Wouldn't it be slick to
pop up a scrolling list of all valid entries, along with the
descriptions they correspond to? Then the user can simply point-
and-shoot. Plus, if the field in question is character-type,
why not give the user a quick search facility to zoom in on the
desired value?
Enter HELPBROW(). This function is best suited for validating
data as described above. Although this function requires more
programming than most of the other Grumpfish functions, it will
be worth the effort. The syntax is as follows:
HELPBROW(<search area>, <return field>, <heading 1>, [<description>,
<heading 2>, <box color>, <row coord>, <col coord>])
Required Parameters:
<search area> is a character string representing the work area to
use for the SEEK. Obviously, this database should be opened prior
to calling HELPBROW(), else the heartbreaking "Type Mismatch" will
ruin someone's day.
<return field> is a character string representing the name of the
field to be returned from the search area. DO NOT include the
alias when specifying this parameter; for example, use 'CODE'
rather than 'TYPES->CODE'.
<heading 1> is a character string representing the heading to be
used for the first column of the browse window.
Optional parameters:
<description> is a character string representing the name of a
secondary field to be displayed in the browse window. As with
the return field parameter, do not include the alias.
<heading 2> is a character string to be used for the heading of
the second column of the browse window.
<box color> is a character string representing the color with
which to draw the browse window. The default is a pleasant
white on blue.
If you wish to display the secondary field on the screen after
validation, use parameters <row coord> and <col coord> as the
row and column coordinates, respectively, at which to display it.
Return Value:
HELPBROW() returns True (.T.) if the variable in the READ is found
in the look-up database or if the user selects one of the values
shown in the browse window. It returns False (.F.) if the user
does not enter a value that is found in the look-up database.
Sample Usage:
Let's suppose that you want to keep track of the gender of everyone
in your 250,000 record rolodex database (you must be very popular).
You thoughtfully design the field GENDER as character type with a
length of one to save space, and create a small look-up database
entitled GENDERS.dbf, which contains the following four records:
Type Description
M MALE
F FEMALE
N NEUTER
O OTHER
You want to display the full gender description on the data entry
screen right next to the field GENDER. This is how you could
write the call to HELPBROW():
@ 16,10 GET mGENDER PICTURE '!' VALID HELPBROW('genders', 'type', ;
'TYPE', 'description', 'DESCRIPTION', '', 16, 13)
Now, if your user enters 'E' (for Eunuch??), (s)he will be
confronted with a window showing the four valid entries and will
be prompted to select one. They will not be able to proceed until
they do so. Once they select a value, the verbose description
will be displayed at row 16, column 13 for reference.
Quick-Search: if the index key in the search area is of character
type, quick-search will automatically be activated. This allows
the user to jump quickly to values by typing in the first few
letters of the desired value. For example, searching for the
code 'RPG' could prove quite tedious in a 100-record database, but
with quick-search the user need only type in the letters 'R' and
'P' to jump directly to it. Your users will love it!
17. PRINTOK()
How many times have you or your users had problems with printers
not being ready? Use this function and you might never have to
deal with "Printer Not Ready.... Retry (Y/N)?" again. Syntax:
PRINTOK()
It returns a logical value. If the printer is ready, it will
return True (.T.) and SET the DEVICE TO PRINT. If the printer is
not ready, it will return False (.F.).
Sample usage:
IF PRINTOK()
DO report
SET DEVICE TO SCREEN
ENDIF
18. DATEST()
If you want to print an empty date field or expression in a report
without printing the slashes (' / / '), use DATEST() instead of
DTOC() like so:
DATEST(<date>)
where <date> is the date field or expression you wish to print.
19. ISSTATE()
This function is useful in applications where the user must input a
two-character state abbreviation. ISSTATE() checks to ensure that a
valid abbreviation has been entered. The syntax is:
ISSTATE(<memvar>)
where <memvar> is a character expression to be tested.
ISSTATE() returns a logical value: True (.T.) if the expression is a
valid state abbreviation, or False (.F.) if it is not.
Sample Usage:
mSTATE = space(2)
@ 10,10 get mSTATE valid isstate(mSTATE)
20. SPREAD()
This function lets you display a character string on the screen
from the middle out. If this does not make sense, try it for
yourself. It is simple, yet slick. The syntax is as follows:
SPREAD(<string>,<row>[,<delay>,<column>])
<string> is the character string to display.
<row> is the row at which to display it.
Optional parameter <delay> is a numeric integer to delay the
effect. The default delay setting is 8. Experiment with this
until you find one that you like.
Optional parameter <column> is a numeric integer specifying the
column at which to spread the string out from (the default is 40).
Sample usage:
SPREAD("This effect will get the user's attention!",12)
SPREAD("This line will be drawn very slowly",14,50)
21. TTY()
This function displays a character string across the screen in a
continuously scrolling "teletype" manner until the user presses
any key. The syntax is as follows:
TTY(<row>, <message>, <delay>)
<row> is a numeric expression representing the row at which to
display the message.
<message> is the character string to be displayed.
<delay> is a numeric expression representing the delay factor to
be introduced into the scrolling process. Values between 10 and
100 are recommended, although you should experiment to determine
what works best on your particular computer.
There is no return value. The message will scroll across the
screen until the user presses a key.
Sample Usage:
TTY(12, 'Press any key to return to the Main Menu', 75)
Thanks again to Jeanne Nerwinski of Durham, NC for suggesting TTY().
22. PASS_CHK()
This is a generic routine to be used whenever the user must enter a
password to continue. The syntax is as follows:
PASS_CHK(<password>, [<row>])
where <password> is a character expression and <row> is an optional
parameter indicating the row number at which you want the "Enter
password..." message to appear.
PASS_CHK() compares the user's entry against the password you
passed to it. The function is case-insensitive.
PASS_CHK() returns a logical value: True (.T.) if the user
enters the correct password, or False (.F.) if they do not.
Sample Usage:
IF pass_chk(chr(77)+chr(79)+chr(79)+chr(76)+chr(65)) && MOOLA
DO payroll
ENDIF
23. RAND()
Here is a random number generator so that you can work on that pop-up
poker game you've been dreaming of! It is driven by the system clock,
so there is no need for you to initialize a 'seed'. Syntax is:
RAND(<range>)
where <range> is an integer numeric expression.
RAND() will return a random integer between zero and <range>-1.
Sample Usage: Output:
? RAND(100) 75
? RAND(50) 22
? RAND(10) 7
By the way, if anyone out there does crave a pop-up poker game and
does not want to invest the time to program one, I know of one
demented individual who might be persuaded to tackle such a project.
24. TIMEWORD()
This function may seem trivial, but believe it or not, you might
find use for it someday. It simply returns a word describing the
time of day (based on the system clock). Syntax:
TIMEWORD()
There are no parameters.
The return value is a character string which relates to the time as
follows:
12:00 am - 11:59 am "Morning"
12:00 pm - 5:59 pm "Afternoon"
6:00 pm - 11:59 pm "Evening"
I use this in several of my multi-user systems in the following
manner: first, an environmental variable with the user's name is
defined in the network login script. Then I grab the user's name
with the Clipper function GETE() and use TIMEWORD() to give them a
personal and time-specific greeting when they enter my program. Not
exactly a cure for cancer, but it is a nice touch.
Sample Usage:
@ 12,20 say 'Good '+TIMEWORD()+', '+user_name
25. GL_VER()
This function simply returns the version number of the Grumpfish
Library that you are using.
Sample Usage:
? GL_VER()
THE SINGING P.C.
A number of musical themes are available to you if you dare to use
them. They are listed below, followed by the code syntax to call them.
1. "Beat It" by Michael Jackson (intro) - DO BEATIT
2. "Born to Run" by Bruce Springsteen (one verse) - DO BORN2RUN
3. "Charge!" as heard at finer sporting events everywhere - DO CHARGE
4. "Mexican Hat Dance", popular at many hockey rinks - DO HATDANCE
5. "The Girl from Ipanema" - DO IPANEMA
6. "Theme from Final Jeopardy" - DO JEOPARDY
7. "Deck The Halls" - DO DECKHALL
8. "Jingle Bells" - DO JINGLE
9. "Rudolph The Red-Nosed Reindeer" - DO RUDOLPH
If you have any musical requests, please let me know!
FUTURE IMPROVEMENTS
If you have any ideas at all (or musical requests), send them my way!!
Greg Lief
P. O. Box 17761
Salem, Oregon 97305
TRADEMARK ACKNOWLEDGEMENTS
CLIPPER is a registered trademark of Nantucket Corporation.
PLINK86 is a registered trademark of Phoenix Technologies.
DOS is a registered trademark of Microsoft Corporation.
TLINK (Turbo Link) is a registered trademark of Borland International.
MASTERMIND is a registered trademark of Pressman Corporation.
LOTUS is a registered trademark of Lotus Development Corporation.
REVISION HISTORY
1.0 - July 1988 (initial release)
1.1 - August 1988 - corrected discrepancy between documentation and
source code regarding hot key implementation for pop-ups. Added
SETFILT(), BATCHREP(), ISSTATE(), RAND(), and <length> parameter for
CENTER().
1.2 - September 1988 - Added POPSTOP, paste function for POPCALC,
and PASS_CHK(). Added solid border box option to EXBOX(). Updated
most functions to properly set colors dependent upon type of
monitor (color vs. monochrome). Corrected MEMED() so that menu
title is centered properly between left and right columns.
1.25 - October 1988 - Added SHRBOX(), SPREAD(), TIMEWORD(),
PRINTOK(), and fill character option for EXBOX(). Cleaned up
documentation and added demo program with supporting databases to
distribution disk.
1.3 - November 1988 - Added multi-user functions (NET_USE, ADD_REC,
FILELOCK, REC_LOCK). Added POPBOX(), DROPBOX(), and GL_VER().
Added IPANEMA to the Singing P.C.'s repertoire, and made it
possible to escape from any of the songs as they play.
1.31 - November 1988 - Fixed persistent bug in POPCALC involving
use and pasting of non-integer numbers, and added TTY().
1.4 - December 1988 - Added POPNOTE and greatly improved the level
of customization available with the pop-up help screens. Added
interactive help screen function (HELPBROW). Also reduced overhead
requirements for BATCHREP(). Made various minor aesthetic changes
in the pop-up applications. Added three Christmas songs to the
Singing P.C.'s expanding repertoire.
1.5 - expected mid-January 1989 - Will add reporting (and perhaps
label) capability to phone directory. Will add appointment minder
to calendar. Will probably make help screen development interface
more 'user-friendly'. May add 'paper tape' function to calculator
if there is enough demand for it. May cure cancer if time permits.