qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
PEN, ON PEN Statements
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
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.
 
PEN ON
PEN OFF
PEN STOP
ON PEN GOSUB line
 
    ■ 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
 
 
See Also    PEN Function