xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

CLEAR TYPEAHEAD

Empties the keyboard buffer.

Syntax

CLEAR TYPEAHEAD

Description

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.

Info

See also:HB_KeyPut(), Inkey(), KEYBOARD, SET TYPEAHEAD
Category: Input commands
Source:rtl\inkey.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe