Here is an introduction to handling keyboard events using the Icon keypad. Responding to Icon keypad events is very easy. You just need to set up the function to handle a particular key event. For Example:
class TestWidget(widget.Widget):
def __init__(self,id=None,title=None, brailleTitle=None):
widget.Widget.__init__(self,id=id,title=title,brailleTitle=brailleTitle)
self.setKeySetHandler('select',self.handleselect)
def handleselect(self):
self.app.say("Select Key Handled")
setKeySetHandler takes two arguments. The first is a label for the key being pressed. The second in the name of the function to be called when the key is pressed.
Here is a list of available keys:
ok
cancel
up
down
left
right
select
selectOrOK
selectOrOKOrRight
selectOrOK_keyUp
selectOrOK_keyDown
home
end
nextWord
prevWord
nextParagraph
prevParagraph
menu
help
delete
backspace
1
2
3
4
5
6
7
8
9
0
*
#
refresh
new
The above key labels will respond to both the icon keypad and the equivalent qwerty keyboard keys.
