Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
malcolm
Posts: 41
Registered: ‎08-01-2008
My Device: Not Specified

Injecting the key combinations Alt+LGLG and Alt+Caps+H

I'm developing a server app so that the blackberry can be remotely controlled across a network. I'm currently trying to add support for the key shortcuts Alt+LGLG and Alt+Caps+H but I'm not having much luck. Here is the code I'm currently trying to use... I wonder if the problem is related to the "held down time" parameter in the Key(Code)Event constructor? I can't quite figure out what significance this parameter has when you are injecting a KEY_UP event?

 

 

//to inject Alt+LGLG to show event logger EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_ALT,0,500)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_DOWN, 'L',KeypadListener.STATUS_ALT,50)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_UP, 'L',KeypadListener.STATUS_ALT,0)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_DOWN, 'G',KeypadListener.STATUS_ALT,50)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_UP, 'G',KeypadListener.STATUS_ALT,0)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_DOWN, 'L',KeypadListener.STATUS_ALT,50)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_UP, 'L',KeypadListener.STATUS_ALT,0)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_DOWN, 'G',KeypadListener.STATUS_ALT,50)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_UP, 'G',KeypadListener.STATUS_ALT,0)); EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_UP, (char)Keypad.KEY_ALT,0,0)); //to inject Alt+Shift+H for "Help me" screen EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_ALT,0,250)); EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_SHIFT_LEFT, KeypadListener.STATUS_ALT,150)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_DOWN, 'H',KeypadListener.STATUS_ALT | KeypadListener.STATUS_SHIFT,50)); EventInjector.invokeEvent( new KeyEvent(KeyEvent.KEY_UP, 'H',KeypadListener.STATUS_ALT | KeypadListener.STATUS_SHIFT,50)); EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_UP, (char)Keypad.KEY_SHIFT_LEFT, KeypadListener.STATUS_ALT,150)); EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_UP, (char)Keypad.KEY_ALT,0,250));

 

 I don't get any errors when I do these sequences of injections but on the other hand, nothing happens either. I've made sure via the debugger that this code path is actually being executed. One thing I can think of is that possibly having the Alt-Down events as well as an explicit "STATUS_ALT" flag might be cancelling each other out, but I'm not sure. I thought I should ask to see if there is something simple I'm missing before I try the countless slight variations on this code I could write...

 

Thanks in advance for your help.

 

Please use plain text.
Developer
Developer
gtj
Posts: 319
Registered: ‎07-20-2008
My Device: Not Specified

Re: Injecting the key combinations Alt+LGLG and Alt+Caps+H

The event log can be displayed by calling EventLog.startEventLogViewer().

 

 Not sure about the status screen but you may be right about over specifying the shifts and alts.

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Injecting the key combinations Alt+LGLG and Alt+Caps+H

It is not possible to inject 3 key combinations.  So you are not able to inject Alt+Caps+H.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.