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
New Developer
naitniq
Posts: 5
Registered: ‎09-16-2008
My Device: Not Specified

How to inject ALT key event?

[ Edited ]

Hi,

I am wondering why when I inject an ALT key event that my application receives the correct key and status in keyDown() or keyChar(), and yet the ALT status does not change. I expect keyStatus() to be called whenever the ALT status changes, but it does not.

  

EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_ALT,0,0))

EventInjector.invokeEvent( new KeyCodeEvent(KeyCodeEvent.KEY_UP, (char)Keypad.KEY_ALT,0,0))

 

Thanks,

Message Edited by naitniq on 09-23-2008 09:00 AM
Message Edited by naitniq on 09-23-2008 09:01 AM
Please use plain text.
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: How to inject ALT key event?

The character in the constructor should be the key you wish to inject.  The third parameter (which you are passing 0 into) is the status modifier key.  Here you can specify KeypadListener.STATUS_ALT to specify the Alt status.
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.
New Developer
naitniq
Posts: 5
Registered: ‎09-16-2008
My Device: Not Specified

Re: How to inject ALT key event?

Can I change ALT status that like press ALT from Keyboard?
Please use plain text.
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: How to inject ALT key event?

No, this is not supported by the event injector.
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.
New Developer
dcorb
Posts: 9
Registered: ‎07-28-2008
My Device: Not Specified

Re: How to inject ALT key event?

I was looking for a way to control the state of the Caps lock key and the Alt key state using event inject. Stated above it is not supported on the Alt key.

 

How about the Caps lock?

Please use plain text.
Developer
dannit
Posts: 48
Registered: ‎10-29-2009
My Device: Not Specified

Re: How to inject ALT key event?

Raising up again.

 

My problem is that i'm creating my own custom components and interface. For input text labels, when I press the alt key it behaves as expected and I can see the alt modifier icon on the top-right of the screen. But the same doesn't happens when I press the shift button.

 

I guess it only works when I'm on system's input text fields.

 

Does anyone know how to handle that?

 

Regards,

Please use plain text.