Command KEYBOARD Foundation

Places a character string into the keyboard buffer.

Syntax
KEYBOARD <cString>
Parameters
<cString>
<cString> is a character expression whose characters are written into the keyboard buffer.
Description

The command KEYBOARD deletes all characters currently in the keyboard buffer and writes the value of <cString> into the keyboard buffer. Characters remain in the keyboard buffer until they are read or deleted. Characters are removed from the keyboard buffer by commands like READ or INPUT, as well as functions like AppEvent(), Inkey(), AChoice() or MemoEdit().

Control characters and Inkey() codes must be converted to ASCII characters using the function Chr() before they are written into the keyboard buffer. Only Inkey() and ASCII codes from 0 to 255 can be inserted into the keyboard buffer.

Strictly speaking, the keyboard buffer in Xbase++ is an event queue where all arriving events are buffered, regardless of whether they are created via the keyboard or the mouse. Since Xbase++ provides an event driven system, the maximum number of characters that can be written into the event queue using KEYBOARD is limited to a range between 10 and 100 characters. Writing more keys into the buffer can make an application uncontrollable. The maximum number is set by the command SET TYPEAHEAD.

Examples
KEYBOARD
// In the example, the F10 key is used as a termination key 
// for MemoEdit(). It is tied to a code block and the code 
// block calls the procedure MemoQuit(). MemoQuit() writes 
// the default termination key Ctrl-W into the keyboard buffer. 

#include "inkey.ch" 

PROCEDURE Main() 
   LOCAL cText  := MemoRead( "TEST.TXT" ) 
   LOCAL bBlock := SetKey( K_F10, {|| MemoQuit() } ) 

   cText := MemoEdit( cText ) 

   MemoWrit( "TEST.TXT", cText ) 
   SetKey( K_F10, bBlock ) 
RETURN 

PROCEDURE MemoQuit() 
   KEYBOARD Chr(K_CTRL_W) 
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.