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

Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

Application Menus

The following page talks about the "Application menu":





But the learning page for menus doesn't seem to mention the application menu, or how to add one to your app:




So the question is: How can a menu be added to an application?

Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Application Menus

Would just sliding a new Container on top of things (higher z order) not do the trick? In QtQuick you could just use a Rectangle, which in this case appears to amount to the same thing. Other controls would go within that item.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Posts: 138
Registered: ‎05-11-2012
My Device: Developer
My Carrier: Developer

Re: Application Menus

Application menus are for infrequent actions and can be hooked into the swipeDown signal - check out the swipeDown signal documentation for more details.



Regular Contributor
Posts: 56
Registered: ‎08-21-2012
My Device: BB10
My Carrier: RIM

Re: Application Menus

Hi, By default the Application Menu is set disabled. So if you want to use it you need to enable it using setMenu method of Application class. bb::cascades::Application::setMenu(menu); 


Here I'm providing you the code. May help you.


#include <bb/cascades/Menu>

#include <bb/cascades/ActionItem>

#include <bb/cascades/HelpActionItem>
#include <bb/cascades/SettingsActionItem>

#include <bb/cascades/Image>


// inside application constuctor..


Menu* menu;


ActionItem* aItem1 = ActionItem::create().title("User Guide").image(Image(QUrl("asset:///images/userguide_icn.png")));

ActionItem* aItem2 = ActionItem::create().title("Phone Height").image(Image(QUrl("asset:///images/phone_height.png")));

ActionItem* aItem3 = ActionItem::create().title("Calibrate").image(Image(QUrl("asset:///images/calibrate_icn.png")));

ActionItem* aItem4 = ActionItem::create().title("Photo Library").image(Image(QUrl("asset:///images/photogallery_icn.png")));

ActionItem* aItem5 = ActionItem::create().title("Settings").image(Image(QUrl("asset:///images/settings_icn.png")));


// HelpActionItem *pHelpAI = HelpActionItem::create();
// SettingsActionItem *pSettingsAI = SettingsActionItem::create();


QObject::connect(aItem1, SIGNAL(triggered()), this,SLOT(handleAction1()));

menu = Menu::create().addAction(aItem1).addAction(aItem2).addAction(aItem3).addAction( 

bb::cascades::Application::setMenu(menu); // this might be missing in your code