PI1X Basic Programming Manual Ver. 1.10
36/156
Purpose
:
To hold all the activated event triggers until they are released
by UNLOCK.
Syntax
:
LOCK
Example
:
ON KEY(1) GOSUB F1
ON KEY(2) GOSUB F2
…
F1:
LOCK
PRINT "press F1"
UNLOCK
RETURN
F2:
PRINT "press F2"
RETURN
In this example, the BASIC program can trap the KEY(1)
and KEY(2) events and reroute to the subroutines F1 and F2
respectively. In F1, the command LOCK disable all the
activated event triggers so that the subroutine F1 will not be
interrupted by a new upcoming KEY(1) and KEY(2) event.
On the other hand, since LOCK is not called in F2, any new
coming KEY(1) and KEY(2) event will interrupt the ongoing
F2, and therefore, may affect the expected results.
Description
:
This command can prevent nesting of event triggers. All the
activated event triggers will be disabled until UNLOCK is
called.