QBasic 1.1: PEN Statement
Explanation
PEN, ON PEN Statements
PEN enables, disables, or suspends light-pen event trapping. If event trapping is enabled, ON PEN branches to a subroutine whenever the light pen is activated.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
PEN ON |
PEN OFF |
PEN STOP |
ON PEN GOSUB line |
Description / Parameter(s)
PEN ON |
Enables light-pen event trapping. |
PEN OFF |
Disables light-pen event trapping. |
PEN STOP |
Suspends light-pen event trapping. Events are processed once event trapping is enabled by PEN ON. |
line |
The label or number of the first line of the event-trapping subroutine. |
Example
'This example requires a light pen.
ON PEN GOSUB Handler
PEN ON
PRINT "Press Esc to exit."
DO UNTIL INKEY$ = CHR$(27): LOOP
END
Handler:
PRINT "Pen is at row"; PEN(6); ", column"; PEN(7)
RETURN