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
Posts: 48
Registered: ‎06-02-2013
My Device: 9780
My Carrier: MTS UKR

Re: Invoking PASTE menu action from a background thread

If I stick to getScreenBelow(), will that help me to get its menu?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Invoking PASTE menu action from a background thread

It has the same problem with respect to Application context. 

 

Can you debug your processing and prove that you are actually getting access to the Field you want? 

Developer
Posts: 48
Registered: ‎06-02-2013
My Device: 9780
My Carrier: MTS UKR

Re: Invoking PASTE menu action from a background thread

While trying getScreenBelow, I just got a ClassCastException. So, I guess, I would rather stick to adding my own menu item and use navigationClick to run it...

Developer
Posts: 48
Registered: ‎06-02-2013
My Device: 9780
My Carrier: MTS UKR

Re: Invoking PASTE menu action from a background thread

OK, finally I got it working with the code for my custom paste menu item:

public Object run(Object context) {
	((UiEngine) Ui.getUiEngine()).getActiveScreen().getLeafFieldWithFocus().paste(Clipboard.getClipboard());
	return context;
}

 Exactly this code runs paste action in whatever field I need. It might also be useful for someone else.

Now I just need to place my custom menu it the appropriate position in order to run it with navigationClick.

Developer
Posts: 48
Registered: ‎06-02-2013
My Device: 9780
My Carrier: MTS UKR

Re: Invoking PASTE menu action from a background thread

I guess it was too early to celebrate the victory.

All I did was just for the sake of having access to event injection in BBM groups. It appeared I really got it. In my simulator. But not on the real device. The difference is that any simulator I can find i spreloaded with BBM 6.x version. And my trick goes smooth with it. But for BBM 7 it is no good.

I am a bit desperate...