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
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Clicking Menu Item from Full Menu also displays Context Menu

My menu item, which is added in the full menu simply refreshes the contents of the ObjectListField that is on my screen.

 

When i click the "Refresh" menu item, it refreshes the contents of my ObjectListField but also pops the Context Menu.

 

Why is this happening? I do not want the Context menu to be displayed after i click "Refresh".

 

Is there a way to solve this?

 

Please help!!!  :smileysad:

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

How are you adding the menu item? What's the code that runs when the menu item is invoked?
New Developer
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

I overrided the makeMenu() method of the MainScreen class.

 

protected void makeMenu(Menu menu,int instance) { if(instance == Menu.INSTANCE_DEFAULT) { add(refreshMenu); super.makeMenu(menu,instance); } }

 This is about it. I called the superof makeMenu so that a Close menu item will be added.

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

You may want to move super.makeMenu outside of the "if" statement so that it super.makeMenu is always executed for all types of menus.

 

What's the code for your Refresh menu item?

New Developer
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

Thanks for the advice.

 

As for the code in my refresh, it's just one line.

 

 

m_listField.set(fileList);

 

 That's it.

 

New Developer
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

Does anybody know why this happens?

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

I think you'll want to consume a click event somewhere; sadly the details of this escape me for the moment, sorry.

Highlighted
New Developer
New Developer
Posts: 23
Registered: ‎04-22-2009
My Device: Not Specified

Re: Clicking Menu Item from Full Menu also displays Context Menu

With list fields you have to capture the navigationClick and return true.  CONSUME_CLICK doesn't work.

 

 

	protected boolean navigationClick(int status, int time){
		if(this.getLeafFieldWithFocus() == selectionList){  // selectionList is the name of your ObjectListField
		   // do something and return true
// selections() is a method with a switch statement that checks the index and performs an action
  if(selections()) return true; }
}