489
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
different properties are responsible for that:
,
,
. Each
property sets the transition delay time in 10ms increments. Setting a property to 0
means that the corresponding transition will never happen. Note that the
maximum value for each property is 254, not 255. All five properties already have
sensible default values, so you only need to change them if you don't like what we
have chosen for you:
kp.pressdelay=4
'40ms (4 successive keypad scans) to cinfirm that the key
is pressed
kp.longpressdelay=150
'1.5 seconds
kp.repeatdelay=0
'we do not want auto-repeat to work
kp.releasedelay=4
'40ms
kp.longreleasedelay=200
'2 seconds
Keypad auto-disable
Finally, you can select several event/code combinations that will automatically
disable the keypad. This is done through the
property.
Each time one of the pre-sent combinations of the key state and key code is
detected, the kp.enabled property will be set to 0- NO, thus preventing further
input until you re-enable the keypad.
This behavior can be very useful. Supposing, you have an application where you
need to enter a certain code, then press <ENTER>. After you press <ENTER>, your
application processes the input, which may take some time. What you often need
is to prevent any further keypad input while the code is being processed. If you do
not do this, the user might continue punching away and creating garbage input
that your system does not need. This might even overwhelm the keypad buffer
(see
). The kp.autodisablecodes makes sure that the
input stops at a certain event/code combination. Up to four such combinations can
be defined.
Here is an example of how this property could be set:
kp.autodisablecodes=str(PL_KP_EVENT_P",49"
'assuming that <ENTER>
key has the code of 49
kp.autodisablecodes="2,49"
'this is because the PL_KP_EVENT_PRESSED
constant is equal to 2
Once all the properties have been preset, enable the kp. object (kp.enabled= 1-
YES), and start processing
.
8.3.14.4
Servicing Keypad Events
the kp. object, you only need to
process keypad events.
is the main event that is generated each time a key transitions to a
new
. The key_event argument will tell you what that new state is,
while the key_code will tell you the code of the key. Event codes are defined in the
495
493
496
495
493
492
489
489
487
494
486