Futurebasic/Language/Reference/tekey function

From Wikibooks, open books for an open world
Jump to navigation Jump to search

TEKEY$[edit | edit source]

Function[edit | edit source]

(+) Appearance (+) Standard Console

Syntax[edit | edit source]

char$ = TEKEY$

Description[edit | edit source]

If there is an active edit field in the current window, and you have designated an edit-event handling routine using the ON EDIT statement, TEKEY$ returns a 1-character string indicating a key that the user pressed. You should check the value of TEKEY$ within your edit-event handling routine, each time that routine is called. When you use an edit-event handling routine, the user's keystrokes are not transmitted directly to the edit field. Based on the value returned by TEKEY$, your edit-event handling routine can decide what to do with the keypress; it can transmit it to the field unaltered, or transmit a different character, or perform some other action. Your routine can use the TEKEY$ statement to transmit the keypress (or some other character) to the edit field, if desired. TEKEY$ values that correspond to the backspace key, and the four arrow keys should generally be transmitted to the field unaltered. Note that any keypresses that can't alter the contents of the field nor move the insertion point are generally not reported to your edit-event handling routine. Keypresses that will not be reported include the following:

  • Arrow keys, if the insertion point is already as far as it can go in the indicated direction (use the DIALOG function (event types _efLeftArrow, _efRightArrow, _efUpArrow and _efDownArrow) to detect arrow keys in this situation);
  • Command-key equivalents for menu items;
  • Command-period.
  • The "Tab" key (use the DIALOG function (event type _efTab or _efShiftTab))The "Clear" key (use *DIALOG function (event type _efClear));
  • The "Return" key, if the field is one of the "NoCR" types (use the DIALOG function (event type _efReturn));

See Also[edit | edit source]

ON EDIT; DIALOG function; TEKEY$ statement