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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

Trouble invoking makeMenu() from a separate non-Screen class

[ Edited ]

Hello,

 

I have the following classes:

 

 

public class QueueScreen extends MainScreen{}

 

 

 

public class GetQueue {

QueueScreen screen;

public GetQueue(QueueScreen screen){
this.screen = screen;
}
}

 

The GetQueue class ultimately updates the UI of the QueueScreen by adding adding a new instance of the same ButtonField to the screen multiple times with screen.add().  What I am looking to do is when one of those buttons has focus, add a particular Menu Item with makeMenu() from within the GetQueue class.

 

To re-iterate with an example: With the GetQueue class, I am adding the same button to the QueueScreen many times (and uniquely identifying the button with setCookie()). Each time one of those buttons is highlighted, I want to add a particular menu item to QueueScreen.

 

I have tried adding a makeMenu() method in QueueScreen and then accessing the method from getQueue. This did not work, however. The only potential way I can think of is to use screen.addMenuItem() when the ButtonField has focus, and then removeMenuItem when the ButtonField does not have focus. I could not get this to work either, because each button is essentially the same (only differing in its cookie).

 

What is the best way to accomplish this? Thanks.

 

 

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

Re: Trouble invoking makeMenu() from a separate non-Screen class

I like this idea.

"use screen.addMenuItem() when the ButtonField has focus"

 

Why doesn't this work?

Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: Trouble invoking makeMenu() from a separate non-Screen class

I was able to get it working. My mistake was that I was trying to manipulate the focus() and unfocus() in my actual buttonfield class. By overriding the buttonfield in the class its implemented in did the trick.

 

Thanks!

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

Re: Trouble invoking makeMenu() from a separate non-Screen class

I appreciate it, but do I deserve kudos for telling you I like your idea?!

 

Anyway, glad you got it going....