xHarbour Reference Documentation > Command Reference |
Empties the keyboard buffer.
CLEAR TYPEAHEAD
The CLEAR TYPEAHEAD command clears the keyboard buffer by removing all pending key strokes from the internal buffer. Key strokes are collected in this buffer, for example, when the user holds a key pressed and the application needs more time for processing key strokes than recording them.
CLEAR TYPEAHEAD is particularly used before calling a function that supports a default key handling, such as Achoice() or DbEdit() or MemoEdit(). When CLEAR TYPEAHEAD is called before such functions, they begin in a defined state.
See also: | HB_KeyPut(), Inkey(), KEYBOARD, SET TYPEAHEAD |
Category: | Input commands |
Source: | rtl\inkey.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates the effect of clearing the keyboard // buffer PROCEDURE MAIN KEYBOARD "xHarbour" DO WHILE NextKey() <> 0 // produce screen output ? Chr( Inkey() ) // by polling the keyboard ENDDO // buffer KEYBOARD "xHarbour" CLEAR TYPEAHEAD DO WHILE NextKey() <> 0 // No screen output ? Chr( Inkey() ) ENDDO RETURN
http://www.xHarbour.com