11-03-2012 11:46 AM
I needto capture keyboard input in cascades because I am developing remote control app. I know that keyboard support doesnt exist in cascades now but I know that support is available in native C. I want a tutorial about how to use C code in cascades to capture keyboard input.
01-04-2013 05:17 PM
You can capture keyboard events using BPS, as show here:
01-05-2013 06:49 AM
01-07-2013 03:04 PM
You will need to set up a loop to handle it though, as that is how BPS works. Basically just put the while loop into it's own thread, and leave out the bits about rendering, and then handle the screen event and screen_val (the key pressed) however you need to.
01-10-2013 03:15 PM - edited 01-10-2013 03:16 PM
This doesn't seem to work. I have set up an event loop in its own thread to capture bps events, but the keyboard key press events don't ever get fired. Is there something that needs to done? I did notice in the docs that you need to subscribe to screen events with a screen context to get key press events. Do we maybe need to use the cascades application screen context? If so, how do you obtain that?
01-10-2013 03:28 PM
If you build a screenService.cpp & .hpp similar to how the virtualKeyboardService is setup in Smart Signals
that should allow you to listen for & interact with screen events
I needed to interact with the Navigator so I took VirtualKeyboardService.cpp & renamed anything keyboard related to functions & data types included in navigator.h & that worked like a charm for me and also helped me understand how to interact with the native API's
01-10-2013 03:48 PM
Thank-you for the rely. Navigator and virtual keyboard events such as when the keyboard is shown work fine. It is only screen events such as key presses, multi-touch, and mouse events that don't get caught because they rely on a valid screen context. I have no problem with any events that don't use a screen context. Not sure why key press events are classified as screen events, but the only way I gran get them to fire is to have a foreign window control that is above cascades, but that keeps you from using cascades overlays and gestures.
01-11-2013 01:37 PM
You could have the foreign window control request focus whenever the user is done using any part of the rest of your UI
04-28-2013 10:43 PM
Have a look at KeyListener in the 10.1. http://developer.blackberry.com/cascades/reference
You might also want to use shortcuts: