FkMax(), FkLabel(), Set Function
These functions and command are one way to use the function keys. FKMAX() and FKLABEL() tell you how many and what function keys are available. SET FUNCTION lets you define a keyboard macro and assign it to a function key.
Usage |
nKeyTotal = FKMAX() cKeyName = FKLABEL( nKey ) |
Example |
PROCEDURE DispFKey * Display a list of all the valid function keys * Pass "ON" or "OFF" to determine COMPATIBLE setting LPARAMETER cSetCompat * cSetCompat determines setting for SET COMPATIBLE * Default to current setting LOCAL cOldCompat, nCnt cOldCompat = SET("COMPATIBLE") IF TYPE('cSetCompat')="C" AND ; INLIST(UPPER(cSetCompat),"ON","OFF") SET COMPATIBLE &cSetCompat ENDIF FOR nCnt = 1 TO FKMAX() ?FKLABEL(nCnt-1) ENDFOR SET COMPATIBLE &cOldCompat RETURN |
Usage |
SET FUNCTION nKeyNumber | cKeyLabel TO [ cCharSequence ] |
There is no way to determine what is stored to a function key macro programmatically. Ted's favorite macro, one to place a comment with his initials and today's date at the end of the current line of code, has to be programmed via the Record Macro dialog each day, because you cannot set macros containing control-key sequences in code. (Of course, in VFP 7, IntelliSense provides a better way to do this.) |
Example |
* Give the user a shortcut for entering today's date SET FUNCTION F9 TO "KEYBOARD DTOC(DATE());" |
See Also |
Clear Macros, On Key Label, Restore Macros, Save Macros, Set, Set Compatible |