Posts: 20
Joined: Mar 2014
Reputation:
0
Hi there,
Does onAction (self, action)
trap mouse and touch screen events? I appear to be having a few issues, I can trap keyboard presses fine.
Thanks for any help
Jason
Posts: 15,266
Joined: Jan 2009
Reputation:
728
ronie
Team-Kodi Member
Posts: 15,266
yes it does capture mouse and touchscreen as well.
Posts: 20
Joined: Mar 2014
Reputation:
0
So I have some code like this
ACTION_PREVIOUS_MENU = 10
ACTION_STOP = 13
ACTION_NAV_BACK = 92
ACTION_BACKSPACE = 110
ACTION_MOUSE_DOUBLE_CLICK = 103
ACTION_MOUSE_LONG_CLICK = 108
ACTION_TOUCH_TAP = 401
ACTION_TOUCH_LONGPRESS = 411
...
def onAction(self, action):
if action in (ACTION_PREVIOUS_MENU,
ACTION_STOP,
ACTION_NAV_BACK,
ACTION_BACKSPACE,
ACTION_MOUSE_DOUBLE_CLICK,
ACTION_MOUSE_LONG_CLICK,
ACTION_TOUCH_TAP,
ACTION_TOUCH_LONGPRESS):
self.isRunning = False
monitor.waitForAbort(.2)
self.close()
Which should detect the action and then go back to a previous screen...if there anything obviously wrong?
Posts: 15,266
Joined: Jan 2009
Reputation:
728
ronie
Team-Kodi Member
Posts: 15,266
i'm not so good at riddles, perhaps you can describe what your actual problem is?
Posts: 20
Joined: Mar 2014
Reputation:
0
I put some debug in the onAction (is it called a "class" now? We used to call them a function in our day) and print out the action.getID() codes, I managed to detect 511 (ACTION_GESTURE_SWIPE_LEFT) and use that.
It's odd that I cannot detect ACTION_TOUCH_TAP or ACTION_TOUCH_LONGPRESS but I have found an acceptable workaround.