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

Native Development

Reply
Highlighted
Developer
Posts: 1,636
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido
Accepted Solution

How to attach context menu to the screen?

So I wanted to add a context menu to the page when I press a button.

 

I'm following the example code from here Context Menu

 

// Create the Container and ActionSet
Container* contextContainer = new Container();
ActionSet* actionSet = ActionSet::create()
        .title("Context menu")
        .subtitle("Select an action.");
 
// Create the ActionItem objects and add them to the ActionSet
ActionItem* action1 = ActionItem::create()
        .title("First action");
ActionItem* action2 = ActionItem::create()
        .title("Second action");
ActionItem* action3 = ActionItem::create()
        .title("Third action");
actionSet->add(action1);
actionSet->add(action2);
actionSet->add(action3);
 
// Add the ActionSet to the Container
contextContainer->addActionSet(actionSet);

 

so how do I actually tell it to display the menu?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to attach context menu to the screen?

It will show up automatically when you long click the container.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 1,636
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: How to attach context menu to the screen?

 

Thanks.  just figured it out.  wish there were examples first.  arrgg