TBrowse() > Event handling |
Evaluates a code block associated with a navigation key.
:applyKey( <nInkey> ) --> nReturnCode
Method :applyKey() instructs a TBrowse object to process user input obtained from function Inkey(). The return value is a numeric code that indicates whether or not the stabilization loop must be terminated. #define constants are listed in the file TBrowse.ch that can be used to test possible return values of :applyKey().
Return values of :applyKey()
Constant | Value | Description |
---|---|---|
TBR_EXIT | -1 | User request for the browse to lose input focus |
TBR_CONTINUE | 0 | Code block associated with <nInkey> was evaluated |
TBR_EXCEPTION | 1 | <nInkey> is unknown, key was not processed |
A TBrowse object maintains a :setKey() dictionary of Inkey() codes and associated code blocks that perform default navigation. The default key processing is as follows:
Default key processing
Inkey code | Method or function | Return code |
---|---|---|
K_DOWN | :down() | TBR_CONTINUE |
K_UP | :up() | TBR_CONTINUE |
K_RIGHT | :right() | TBR_CONTINUE |
K_LEFT | :left() | TBR_CONTINUE |
K_CTRL_LEFT | :panLeft() | TBR_CONTINUE |
K_CTRL_RIGHT | :panRight() | TBR_CONTINUE |
K_END | :end() | TBR_CONTINUE |
K_HOME | :home() | TBR_CONTINUE |
K_CTRL_END | :panEnd() | TBR_CONTINUE |
K_CTRL_HOME | :panHome() | TBR_CONTINUE |
K_PGDN | :pageDown() | TBR_CONTINUE |
K_PGUP | :pageUp() | TBR_CONTINUE |
K_CTRL_PGDN | :goBottom() | TBR_CONTINUE |
K_CTRL_PGUP | :goTop() | TBR_CONTINUE |
K_ESC | None | TBR_EXIT |
K_LBUTTONDOWN | TBMouse() | see below |
other codes | TBR_EXCEPTION |
When the browse display is clicked with the mouse and a data cell is hit, :applyKey() returns TBR_CONTINUE. If no data is hit, the return code is TBR_EXCEPTION.
http://www.xHarbour.com