Command CLEAR TYPEAHEAD Foundation
Deletes all characters from the keyboard buffer or the event queue.
Syntax
CLEAR TYPEAHEAD
Description
The command CLEAR TYPEAHEAD deletes all characters currently found in the keyboard buffer or event queue, respecively. The command is generally used before calling functions which independently react to keyboard input. This includes functions like AChoice(), DbEdit() or MemoEdit(). In such cases, CLEAR TYPEAHEAD guarantees that no key codes or events are already waiting for processing.
Examples
// In the example, characters are written into the keyboard
// buffer. To keep these characters from being processed
// by MemoEdit(), the command CLEAR TYPEAHEAD erases the
// keyboard buffer before the call to MemoEdit()
PROCEDURE Main
LOCAL cText := ""
KEYBOARD "Xbase++"
? NextKey() // result: 88
? Chr( NextKey() ) // result: X
CLEAR TYPEAHEAD
? NextKey() // result: 0
cText := MemoEdit(cText)
RETURN
Feedback
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.