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
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar
Accepted Solution

Disable Application Menu

I have a navigationPane with an Application Menu. One of items of this menu is Settings so
when I click Setting I show the Setting Page but I would like to disable the Application Menu
when the user to settings page

I put in the onCreationCompleted of my settingPage
Application.menuEnabled = false;

And when I click the back button i do:
Application.menuEnabled = true;
navigationPane.pop();

However the Application Menu is still shown in the settings page, so how can I turn it off ?

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Disable Application Menu

I did it!!

When I push the settings page, i disbale the application menu for that page, so

ActionItem {
	title: "Preferencias"
	imageSource: "asset:///images/ic_settings.png"
	onTriggered: {
		var page = getPreferenciasPage();
		page.onRefreshDropDownLicencia.connect(onRefreshDropDownLicencia);
		Application.menuEnabled = false;
		navigationPane.push(page);
	}
	function getPreferenciasPage() {
		if (! preferenciasPage) {
			preferenciasPage = idPreferenciasPage.createObject();
		}
		return preferenciasPage;
	}
},

 

Developer
Posts: 24
Registered: ‎10-31-2012
My Device: Dev Alpha B
My Carrier: COMPE

Re: Disable Application Menu

Why turn off the menu?

Normally the settings menu is called using a sheet.
__
Helped you? Like me.
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Disable Application Menu

It's because I got a item in my SettingPage taht is loaded from a database and the user could do a full CRUD in that table.

In my Setting page I have an ActionItem that takes the user to that CRUD page...

Is this a better way to do this ?

 

Thanks...

Developer
Posts: 24
Registered: ‎10-31-2012
My Device: Dev Alpha B
My Carrier: COMPE

Re: Disable Application Menu

No code is difficult to assess.

But if you use NavagationPane to open the settings for the BFB is already wrong. The right way is using the Sheet.
__
Helped you? Like me.
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Disable Application Menu

OK.
Thanks for the tip
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Disable Application Menu


laairoy wrote:
But if you use NavagationPane to open the settings for the BFB is already wrong. The right way is using the Sheet.

Do you have some reference for why you think this is the case? I'd say it's wrong for several reasons.

 

One is that the UI Guidelines say otherwise: https://developer.blackberry.com/design/bb10/menus.html (last item on page): "For actions that open a new view (such as settings and help), slide the menu up and slide the new view in from the right. For actions that open a dialog or toast, slide the menu up and then display the dialog or toast."

 

Another is that I have two Built For BlackBerry apps, both of which open a new Page in a NavigationPane when you select Settings (or Help) from the top menu.


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!
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Disable Application Menu


YamilBracho wrote:
Is this a better way to do this ?

Probably, yes.

 

On your NavigationPane, add handlers for onTopChanged and/or onPopTransitionEnded. In those, check page.objectName to see if it matches the page (or pages) where you want to disable the top menu, and change the state of that Application flag accordingly.

 

Then add objectName: 'somepagename' with an appropriate page name to each of the Pages in your app.

 

You can just specify that property on the one page if you have a simple app with only a few pages but otherwise I'd recommend setting it on each, since it will provide other benefits later and you can also use it in your debug logging output.


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!
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Disable Application Menu

Thanks Peter

That's what I did...