xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET KEY

Associates a key with a procedure.

Syntax

SET KEY <nInkeyCode> TO [<ProcedureName>]

Arguments

<nInkeyCode>
<nInkeyCode> is the numeric Inkey() value of the key to associate with a procedure. Refer to the file INKEY.CH for numeric key codes.
TO <ProcedureName>
The name of the procedure to execute must be specified as a literal name or as a macro expression. When the parameter is omitted, the procedure association is removed from the key.

Description

The SET KEY command associates a key with a procedure. The procedure is executed automatically when the key is pressed during a wait state. A wait state is employed by functions and commands that wait for user input, except for the Inkey() function. This includes the AChoice(), DBEdit(), MemoEdit() functions, and the ACCEPT, INPUT, READ and WAIT commands.

The associated procedure receives as parameters the return values of ProcName(), ProcLine() and ReadVar().

Notes:  SET KEY is a compatibility command superseded by the SetKey() function.

The F1 key is automatically associated with a procedure named HELP at program start. If such a procedure is linked, it is executed when F1 is pressed during a wait state.

Info

See also:Inkey(), KEYBOARD, LastKey(), PROCEDURE, ProcLine(), SetKey()
Category: SET commands
Header:Inkey.ch
Source:rtl\setkey.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// Refer to the SetKey() function for an example.

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe