17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

KEY(n) Statement<br />

Purpose:<br />

To initiate and terminate key capture in a GW-BASIC program.<br />

Syntax:<br />

KEY(n) ON<br />

KEY(n) OFF<br />

KEY(n) STOP<br />

Comments:<br />

n is a number from 1 to 20 that indicates which key is to be captured. Keys are numbered as<br />

follows:<br />

Key NumberKey<br />

1-10 Function keys F1 through F10<br />

11 CURSOR UP<br />

12 CURSOR LEFT<br />

13 CURSOR RIGHT<br />

14 CURSOR DOWN<br />

15-20 Keys defined in the following format (see KEY statement): KEY n, CHR$(hex<br />

code) + CHR$(scan code)<br />

Execution of the KEY(n) ON statement is required to activate keystroke capture from the<br />

function keys or cursor control keys. When the KEY(n) ON statement is activated and enabled,<br />

GW-BASIC checks each new statement to see if the specified key is pressed. If so, GW-BASIC<br />

performs a GOSUB to the line number specified in the ON KEY(n) statement. An ON KEY(n)<br />

statement must precede a KEY(n) statement.<br />

When KEY(n) OFF is executed, no key capture occurs and no keystrokes are retained.<br />

If KEY(n) STOP is executed, no key capture occurs, but if a specified key is pressed, the<br />

keystroke is retained so that immediate keystroke capture occurs when a KEY(n) ON is executed.<br />

For further information on key trapping, see the ON KEY(n) statement.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/KEYN.html28/03/2004 21.28.59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!