xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

KEYBOARD

Writes a string or numeric key codes into the keyboard buffer.

Syntax

KEYBOARD <cString>
KEYBOARD <nInkeyCode>
KEYBOARD <aKeyCodes> 

Arguments

<cString>
This is the character string that is written into the keyboard buffer.
<nInkeyCode>
Alternatively, a numeric key code can be specified. Normally, the #define constants listed in the Inkey.ch files are used for <nInkeyCode>.
<aKeyCodes>
A mixture of character strings or numeric key codes can be specified as a one dimensional array.

Description

The KEYBOARD command first clears the keyboard buffer and then fills it with the key codes specified as character strin, numeric values or within an array. Thus, all pending key strokes are discarded before new characters are written into the keyboard buffer. They remain in the buffer until being fetched from it during a wait state in which the keyboard buffer is polled for the next key stroke.

Wait states are employed by functions and commands that wait for user input, such as Achoice(), READ or MemoEdit().

Info

See also:Chr(), CLEAR TYPEAHEAD, HB_KeyPut(), Inkey(), LastKey(), NextKey(), SET KEY, SET TYPEAHEAD
Category: Input commands
Header:Inkey.ch
Source:rtl\inkey.c
LIB:xhbdll.lib
DLL:xhbdll.dll

Examples

// The example writes a string into the keyboard buffer so that
// Memoedit() begins editing this text in a new line.

   PROCEDURE MAIN
      LOCAL cString

      KEYBOARD "xHarbour:" + Chr(13) + Chr(10)

      cString := MemoEdit()

      CLS
      ? cString
   RETURN

 

// The example does the same as the previous one but
// passes an array to the KEYBOARD command.

   PROCEDURE MAIN
      LOCAL cString

      KEYBOARD { "xHarbour:", 13, 10 }

      cString := MemoEdit()

      CLS
      ? cString
   RETURN

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