Function SetKey() Foundation
Associates a code block with a specific key.
SetKey( <nInkey>, [<bNewBlock>] ) --> bOldBlock
SetKey() works like the function Set(). When SetKey() is called without the argument <bNewBlock>, the function returns the code block currently associated with the key. When no code block is set for the key, NIL is returned. If <bNewBlock> is specified, the new block is attached to the key and the old code block or NIL is returned.
The function SetKey() is a compatibility function which attaches a code block to keys registered by the function Inkey(). In the Xbase++ system, the function SetAppEvent() should be used instead of SetKey(). SetAppEvent() allows a code block to be attached to a specific event. Code blocks can also be associated with mouse events. Also, SetAppEvent() supports keyboard events not recognized by Inkey().
The environment function SetKey() attaches a code block to a specific key or retrieves the currently attached code block. Specific commands and functions, which do not read the keyboard with Inkey(), automatically execute the code block. These include the commands ACCEPT, INPUT, READ and WAIT as well as the functions AChoice(), DbEdit() and MemoEdit(). When the code block is automatically evaluated by these commands or functions, three arguments are passed to it. These arguments are the return values of the functions ProcName(), ProcLine() and ReadVar().
Instead of SetKey(), the command SET KEY can be used. When SET KEY is used to attach a code block to the key, it does not allow the code block previously attached to the key to be saved.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.