Dec 162017
 
Simple way to set function keys in Clipper so they call procedures.
File FKEYS.ZIP from The Programmer’s Corner in
Category Dbase Source Code
Simple way to set function keys in Clipper so they call procedures.
File Name File Size Zip Size Zip Type
FKEYS.DOC 4706 1664 deflated

Download File FKEYS.ZIP Here

Contents of the FKEYS.DOC file


******************************************************************************
* GRIMM ENTERPRISES
* WRITTEN BY J.C. GRIMM
* CIS # 73537,2403
* BELMONT, OHIO 43718
* Here is a quick and easy way to program your FUNCTION keys for different
* procedures. It was designed so that, during programming, you can assign
* procedures to a function key with the addition of only one (1) line of code.
* This makes easy work in the development process. It was also designed to
* turn the function keys off when you are within one of these procedures.
* I designed it this way for simplicity. Confusion of multiple windows on
* the screen in conjunction with "save screen" and "restore screen" caused
* unnecessary problems. I wanted the code to be very simple and straight
* forward.
* I originally wanted to find a way to save the EXACT status of the fkeys
* to a disk file or something similar to that. I would have like to have
* a procedure that would work like the "SAVE SCREEN" command. That would
* be great. Just have a single command like "SAVE FKEYS". Basically this
* is what I have done in a very few lines of code. It also maintains its
* flexibility.
*
* I have developed many such generic functions and procedures throughout the
* development of an Optometric Office Management software package, due for
* release soon, over the past 3 years. Keep an eye on Compuserve Nanforum
* for future procedures and the release of the Optometric Package.
*
* Any suggestions on this or future procedures to simplify the code are
* welcome. If you like and use this procedure, you are welcome to do so, but
* mention me somewhere within your program. Thanks!
*
*
* Portions of the code are as follows:
*
* Declare the memory variables in the calling program or, as I did, declare
* them public.
PUBLIC FKEY1,FKEY2,FKEY3,FKEY4,FKEY5,FKEY6,FKEY7,FKEY8,FKEY9
FKEY1="TURNEDOFF"
FKEY2="TURNEDOFF"
FKEY3="TURNEDOFF"
FKEY4="TURNEDOFF"
FKEY5="TURNEDOFF"
FKEY6="TURNEDOFF"
FKEY7="TURNEDOFF"
FKEY8="TURNEDOFF"
FKEY9="TURNEDOFF"

* Main program to add or edit data

DO WHILE ! DONE
* turn off all fkeys
DO FKEYSOFF
* clear all fkey variables
DO FKVAROFF
* assign new memory variables
FKEY3="MEMEDIT" && F3 KEY memedit is a procedure name
FKEY2="ZIPS" && F2 KEY zips is a procedure name
* turn on fkeys with appropriate memory variables as defined above
DO FKEYSON
* program code to paint screen, input data, edit data, etc.
DO CFNEWPAT
READ
* turn off fkeys after finished with edit screen
DO FKEYSOFF
* clear all fkey variables just in case ( I'm cautious)
DO FKVAROFF
ENDDO

* Library of procedures. ( I like to put them in my first overlay file )
* just make sure your programs have access to them.

* Procedure to assign dummy value to unnecessary fkeys
PROCEDURE TURNEDOFF
RETURN

* Procedure to set fkeys for named procedures
PROCEDURE FKEYSON
SET KEY 28 TO HELP
SET KEY -1 TO &FKEY2
SET KEY -2 TO &FKEY3
SET KEY -3 TO &FKEY4
SET KEY -4 TO &FKEY5
SET KEY -5 TO &FKEY6
SET KEY -6 TO &FKEY7
SET KEY -7 TO &FKEY8
SET KEY -8 TO &FKEY9
RETURN

* Procedure to turn off fkeys.
PROCEDURE FKEYSOFF
SET KEY -8 TO && F9 KEY
SET KEY -7 TO && F8 KEY
SET KEY -6 TO && F7 KEY
SET KEY -5 TO && F6 KEY
SET KEY -4 TO && F5 KEY
SET KEY -3 TO && F4 KEY
SET KEY -2 TO && F3 KEY
SET KEY -1 TO && F2 KEY
RETURN

* Procedure to assign a dummy value to the fkeys memory variables.
PROCEDURE FKVAROFF
FKEY1 ="TURNEDOFF"
FKEY2 ="TURNEDOFF"
FKEY3 ="TURNEDOFF"
FKEY4 ="TURNEDOFF"
FKEY5 ="TURNEDOFF"
FKEY6 ="TURNEDOFF"
FKEY7 ="TURNEDOFF"
FKEY8 ="TURNEDOFF"
FKEY9 ="TURNEDOFF"
FKEY10="TURNEDOFF"
RETURN

* Program portion of procedure called when fkey is struck
PROCEDURE ZIPS && list zip codes to screen, etc.
SAVE SCREEN
* turn off remaining fkeys
DO FKEYSOFF
* turn off help ( I like it that way )
SET KEY 28 TO
* select database
* list zips to screen etc.
* close data file
* turn on fkeys exactly as they were set prior to this procedure
DO FKEYSON
RESTORE SCREEN
RETURN


* end


 December 16, 2017  Add comments

 Leave a Reply

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

(required)

(required)