Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
misty83
Posts: 745
Registered: 01-04-2009

2 keys shortcut

hi, how can i simulate alt+arrow shortcut?

 

kind regards

Please use plain text.
Developer
Posts: 432
Registered: 02-23-2009

Re: 2 keys shortcut

You can use CTRL key of the keyboard to simulate ALT key using keyboard

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
Please use plain text.
Developer
misty83
Posts: 745
Registered: 01-04-2009

Re: 2 keys shortcut

i do not understand You. i've got alt key on my device. i even have a key code of it. the problem is how to simulate alt+escape. so that i can get a shortcut as on real device. i do not need CTRL. my problem is how to simulate that the alt is pressed(and not released), then escape is pressed and after that alt is released.
Please use plain text.
Developer
Posts: 432
Registered: 02-23-2009

Re: 2 keys shortcut

you want to simulate these keyevents on simulator or you need to trace these keyevents?  if you want to trace keyevents then you can use STATUS_ALT as status in keyPadListener and Keypad.KEY_ESCAPE for escape key

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

 

Deepesh Gupta
Please use plain text.
Developer
misty83
Posts: 745
Registered: 01-04-2009

Re: 2 keys shortcut

i need to trace them. i triedd to use what You've mentioned but what i got it was as i only pressed 'escape', not 'alt+escape'. Here is my code:

 

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

 

 

EventInjector.invokeEvent(
new KeyCodeEvent(KeyCodeEvent.KEY_DOWN,

(char)Keypad.KEY_ESCAPE,KeypadListener.

STATUS_ALT, 150));

 

 

 

EventInjector.invokeEvent(
new KeyCodeEvent(KeyCodeEvent.KEY_UP,

(char)Keypad.KEY_ESCAPE,KeypadListener.

STATUS_ALT, 150));

 

 

EventInjector.invokeEvent(
new KeyCodeEvent(KeyCodeEvent.KEY_UP,

(char)Keypad.KEY_ALT, 0, 250));

Please use plain text.
Developer
Posts: 432
Registered: 02-23-2009

Re: 2 keys shortcut

Oh... You need to inject the events. Use this piece of code

 

 

EventInjector.KeyCodeEvent ev = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeE vent.KEY_DOWN, ((char)Keypad.KEY_ESCAPE), KeypadListener.STATUS_ALT, 500);

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

 

 

Deepesh Gupta
Please use plain text.
Developer
misty83
Posts: 745
Registered: 01-04-2009

Re: 2 keys shortcut

i tried Your example and add post method :

EventInjector.KeyCodeEvent ev = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_DOWN, ((char)Keypad.KEY_ESCAPE), KeypadListener.STATUS_ALT, 500); ev.post();

 

but still it works as i pressed only escape, not 'alt+escape'..
Please use plain text.
Developer
misty83
Posts: 745
Registered: 01-04-2009

Re: 2 keys shortcut

now i've noticed very strange thing-when i'm in my application or in applications this code behaves as 'escape'. but when i get into main screen of mobile it works as 'alt+escape' so as i wanted. why it is like that?
Please use plain text.
Administrator
MSohm
Posts: 11,465
Registered: 07-09-2008
My Carrier: Bell

Re: 2 keys shortcut

What BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
misty83
Posts: 745
Registered: 01-04-2009

Re: 2 keys shortcut

i'm testing on few devices: 8300 - 4.5.0.69, 8800 - 4.5.0.55 and 8700 with 4.5.0.52
Please use plain text.