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
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer
My Carrier: relience
Accepted Solution

While clinking on button menu appears

Hello,

 

I had implemented menu in my app sucessfully.

But I am facing one another problem,

When I click on the button menu appears as context menu.(see the below image)

I dont want that menu to be appear while I am clicking on button field.

This menu is appearing when I click on any of the button.

 

 

 

Quit

and show result is the menu that I added in my screen.

 

in constructor

addMenuItem(_mnu_showresult);
        addMenuItem(_mnu_quit);

 

/*declared menu item*/

 

private MenuItem _mnu_showresult = new MenuItem(new StringProvider(
            "Show Result"), 110, 1) {
        public void run() {      
            Dialog.alert("You had scored ");

        }
    };

    private MenuItem _mnu_quit = new MenuItem(new StringProvider("Quit"), 110, 2) {
        public void run() {


        }
    };

 

 

How I can solve the problem?

 

Thanks in advance.

bskania.

 

Please use plain text.
Developer
lakshman9687
Posts: 243
Registered: ‎07-22-2011
My Device: BlackBerry Z10
My Carrier: AirTel

Re: While clinking on button menu appears

Hi,

 

Use ButtonField.Consume click to avoid that menu.

 

ButtonField myBtn = new ButtonField("My Button",ButtonField.ConsumeClick);

 

Regards,

Lakshman K

----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: While clinking on button menu appears

Can I also recommend that you search the forum before you post a question.  In this case, if you had searched for "button menu" you would have found other Threads that have reported the same problem and resolved it using ButtonField.CONSUME_CLICK as suggested above.

Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer
My Carrier: relience

Re: While clinking on button menu appears

Thanks for the solution and next time I will try my best to find out first solution with each keyword in the search bar
.
Please use plain text.