491
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
kp.scanlinesmapping="24,25,26,27"
kp.returnlinesmapping="28,29,30,31"
io.num=PL_IO_NUM_24
io.enabled=YES
io.num=PL_IO_NUM_25
io.enabled=YES
io.num=PL_IO_NUM_26
io.enabled=YES
io.num=PL_IO_NUM_27
io.enabled=YES
'we are not going to change default delay values -- we like them as they
are (we came up with them, after all)
kp.autodisablecodes=str(PL_KP_EVENT_P",49"
'<ENTER> will disable
further input
kp.enabled=YES
Here is an example of the event handler that adds your input to the inp_str string
(global variable), clears the string when the <CANCEL> key is pressed, and
launches the mysterious process_it procedure when the <ENTER> key is pressed:
Sub
On
_kp(key_event
As
pl_kp_event_codes, key_code
As
Byte
)
Dim
x
As
Byte
If
key_event=PL_KP_EVENT_PRESSED
Then
Select
Case
key_code
Case
&h1: x=1
Case
&h11: x=2
Case
&h21: x=3
Case
&h2: x=4
Case
&h12: x=5
Case
&h22: x=6
Case
&h3: x=7
Case
&h13: x=8
Case
&h23: x=9
Case
&h33: x=0
Case
&h32:
'<CANCEL>
inp_str=""
Exit
Sub
Case
&h31:
'<ENTER> will disable the keypad...
process_it()
inp_str=""
kp.enabled=YES
'... so we re-enable it
Exit
Sub
End
Select
inp_str=chr(x)
'we will be here only when a numerical key is
pressed (see 'exit sub' under CANCEL and ENTER keys)
End
If
End
Sub
Handling keypad buffer overflows
Another event --
-- tells you that the input buffer of the keypad
has been overwhelmed with frantic user input and the kp. object is not disabled.
You respond appropriately:
494