HTBasic Help
×
Menu
Index

OUTPUT KBD

 
OUTPUT KBD sends keystrokes to the keyboard buffer, just as if someone had typed them. This can be useful in giving a default response for INPUT that a user can edit:
 
OUTPUT KBD;"STUDENT.DAT";
INPUT "Enter a filename:",F$
 
Function keys can be invoked by first sending CHR$(255) followed by the function key code. A table giving the second character codes is found in Chapter 4 of the Getting Started Guide.
 
OUTPUT KBD;"""AUTOST File Complete"""&CHR$(255)&"E";
WAIT 1
OUTPUT KBD;CHR$(255)&"!"&"SCRATCH"&CHR$(255)&"E";
END
 
The first line in this example shows how to display your own messages on the message line. The ENTER key is output to the keyboard with the two characters, CHR$(255)&"E". The semicolon at the end of the line prevents carriage-return/line-feed characters from being sent to the keyboard. Line 30 is a handy line to execute at the end of your AUTOST file. The CHR$(255)&"!" characters are the STOP key, followed by a SCRATCH statement. This will cause your AUTOST file to be SCRATCHed from memory after it is executed.
 
The CHR$(255) character displays as a reverse-video "K" on an HP BASIC Workstation. On other computers, it displays differently. PCs using standard PC character sets (code pages) display the character as a space. It is possible to load an HP compatible character set. See Chapter 12, "International Language Support."
 
CONTROL KBD and STATUS KBD
The CONTROL KBD statement can be used to control various keyboard attributes, while the STATUS KBD can be used to read the status of those attributes. A complete list of the CONTROL and STATUS registers for the keyboard is given at the end of this section. The following is an example:
 
CONTROL KBD,16;1 ! disable all scrolling keys
 
This is useful if you have displayed a screen image that you wish to prevent the user from scrolling off the screen.