kp. Object

The kp. object icon.

The kp. object of TiOS running on Tibbo hardware works with attached matrix or binary keypads.

The kp. object of the TiOS Simulator works with 16 buttons placed in the TiOS Simulator's window.


Differences from the "real" kp. object:

kp.idlecode

Must be set to 255.

kp.mode

Must be set to 1 — PL_KP_MODE_BINARY.

kp.pressdelay

The recommended value is 1. This is because the TiOS Simulator's buttons are already "debounced."

kp.returnlinesmapping

Not implemented. Changing the value of this property will have no effect on the operation of the virtual keypad.

kp.scanlinesmapping

Not implemented. Changing the value of this property will have no effect on the operation of the virtual keypad.

kp.setlabel

This method is supported only on the TiOS Simulator (see below).


All other aspects of the TiOS Simulator's kp. object follow our "real" kp. object found on Tibbo devices.


The kp.setlabel Method

This method has been added to allow labeling the buttons of the virtual keypad displayed by the TiOS Simulator.

By default, each button label shows the key code of the button. You can change this to something more meaningful. For example, here is the code that sets button labels in the Calculator sample project:

Tibbo BASIC
kp.setlabel(0,"+") 'the first argument is the key code, the second argument is the label for the button with the matching key code
kp.setlabel(1,"-")
kp.setlabel(2,"*")
kp.setlabel(3,"/")
kp.setlabel(4,"1")
kp.setlabel(5,"2")
kp.setlabel(6,"3")
kp.setlabel(7,"+/-")
kp.setlabel(8,"4")
kp.setlabel(9,"5")
kp.setlabel(10,"6")
kp.setlabel(11,"=")
kp.setlabel(12,"7")
kp.setlabel(13,"8")
kp.setlabel(14,"9")
kp.setlabel(15,"0")

See the result in the screenshot found in TiOS Simulator Window.


kp. Object

The kp.setlabel Method