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: 5
Registered: ‎07-31-2009
My Device: Not Specified
Accepted Solution

Manually Show Menu?

Sometimes when I click on one of my fields, the popup menu (context menu displayed where user touches screen) displays. Other times, it doesn't.

 

I've looked at the docs and searched the forums, but I can't find out exactly what controls this. I do not have an overridden navigationClick() or anything like that.

 

Is there an option or setting that controls this? Or is there a way to manually display the menu?

 

Thanks for any info,

 

-Andy 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Manually Show Menu?

This is generally caused by failure to consume the click.

 

For a button field, add the style CONSUME_CLICK to your ButtonField constructor.

 

New Developer
Posts: 5
Registered: ‎07-31-2009
My Device: Not Specified

Re: Manually Show Menu?

Thanks. That is valuable insight that I think is putting me in the right direction.

 

The field is a RichTextField, though. It does not have a CONSUME_CLICK option, but it does have CONSUME_INPUT as it is a subclass of TextField.

 

The desired behavior for me would be for the menu to display on click, but that is apparently not the default behavior for a RichTextField.

 

I tried adding the CONSUME_INPUT style, but that did not work, which isn't surprising.

 

What would be the best way to have the click event bubble up for a RichTextField? 

New Developer
Posts: 5
Registered: ‎07-31-2009
My Device: Not Specified

Re: Manually Show Menu?

I've figured out how to get what I want.

 

Since I'm not using a Button, CONSUME_CLICK wouldn't work for me. What I needed to do was override navigationClick. One key thing I was missing is that the navigationClick, touchEvent, etc. methods are called on the most deeply nested Manager. Once I figured that out, and overrode the proper methods and added return false, the events bubbled up as I desired.

 

Thanks for pointing me in the right direction. 

Highlighted
Contributor
Posts: 26
Registered: ‎06-27-2012
My Device: Playbook
My Carrier: n/a

Re: Manually Show Menu?

So did you find a way to manually invoke context menus?