Image bm334.GIF Keyboard
Controls
 
Image bm338.GIF keys
Image bm339.GIF character input (waits to be pressed)
Image bm340.GIF character input (does not wait for press)
 
The character input element returns a text containing one keyboard character. A character can be generated by character keys only and by some control keys generating controlling ASCII characters. Other control keys generate no character. The generated character depends on the preset national code page and on the keyboard driver (characters containing diacritics). The element without waiting returns an empty text if no character is ready. The element with waiting can be used as an independent command (ignoring the returned character), thus causing the program being hold up to the instant of pressing a character key.
 
Image bm341.GIF key input (waits to be pressed)
Image bm342.GIF key input (does not wait for press)
 
The key input element returns the number representing the numeric code of a pressed key. Unlike the character input this code is generated by all keys. It is independent both on the national code page and on the keyboard driver. The element without waiting returns 0 if no key is ready. The element with waiting can be used as an independent command (ignoring the returned key), thus causing the program being hold up to the instant of pressing any key.
 
Image bm343.GIF there is pressed key
 
The there is pressed key element is used for testing the condition of some of the keys being pressed. The previous functions for character entry and key entry generate a character when pressing the key and then repeatedly after a while, if the key is being held. In contrast to it this function makes it possible to test the condition of the corresponding key being pressed and held independent on character generation during holding the key. The code of the key to be tested has to be entered as a parameter. The function output is a logic value indicating, if the key is depressed and held. A special case is the code 0 (= no key) indicating that no key is depressed.
 
Image bm344.GIF flush out of key buffer
 
In order that no entered key may go astray in the program the codes are stored in the key buffer up to the instant of picking them out. The flush out of key buffer command causes the key buffer to be emptied if we want to wait for a keystroke, and the previously pressed keys are not important for us. The command will empty the buffer both of the keys and that of the characters (separate buffers are used).
 
Image bm345.GIF status of Num Lock
Image bm346.GIF status of Caps Lock
Image bm347.GIF status of Scroll Lock
Image bm348.GIF status of Insert
 
The elements of the key shifts are logic variables that return a flag indicating that the relevant shift is on. These elements can also be used as commands, i.e. the shift condition may be set to a desired logic value. It is, however, recommended to use this in a case of necessity only, because in some computer types this operation may not be executed properly (for example, the key indicator condition may not agree with the shift key condition).

Full Html Context Help of The Peter - Gemtree Software & Children Programming