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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Contributor
Posts: 12
Registered: ‎08-24-2012
My Device: Bold9780, PlayBook, Dev Alpha
My Carrier: Vodafone

navigationPane issue: when multiple pages are opened how do I show one that is not visible?

Thanks for reading this.

 

I have an application with three buttons in the menubar (topmenu, swipe down from top bezel), help, info, settings. They can all be opened one after each other. I do not close an open Page, so they are all stacked on top of each other (which can be using using the swipe right.) Now here's the issue, when helpPage is below the settinsPage, I wish that it becomes on top of the settingsPage when I press the button "help" (in the menubar). I couldn't get that to work. But after some searching I found something that works. It may help others too, nevertheless, I also want to if this code is okay. If mean there might be a better way to do this, or worse, this could be a problematic way to do this. Here's the code:

 

There's a qml file holding the ui elements of the SettingsPage, which also contains code to close the page using the naviationPane.pop() command.

 

In the main.qml there's some initialization

.

.

NavigationPane {

    id: navigationPane

.

.

.

    propertyPagesettingsPage

    function getSettingsPage() {

        if (! settingsPage) {

            settingsPage = settingsPageDefinition.createObject();

        }

        return settingsPage;

    }

.

.

    attachedObjects: [

        ComponentDefinition {

            id: settingsPageDefinition

            source: "SettingsPage.qml"

        },

.

.   

  Menu.definition: MenuDefinition {

        settingsAction: SettingsActionItem {

            id: settingsScreen            

            onTriggered : {

                var page = getSettingsPage();

                console.debug("pushing settings " + page)

                navigationPane.push(page);

                navigateTo(settingsPage);

            }   

        }

        helpAction: HelpActionItem {

            id: helpScreen

            onTriggered: {

                var page = getHelpPage();

                console.debug("pushing help " + page)

                navigationPane.push(page);

                navigateTo(helpPage);

            }   

        }

.

.

 

Everything is pretty standard, i.e. what you get iwhen you create an empty project with a navigationpane. The thing I I added to create the functionality that the Page which I ask for by clicking on the button, e.g. "help", appears on top is  "navigateTo(helpPage);". Is this a correct use of navigateTo and/or is there a better way.

 

Thanks a lot for your help!

 

 

William

 

 

 

Developer
Posts: 648
Registered: ‎09-26-2012
My Device: Limited Edition Z10, Playbook 16GB/32GB, Dev Alpha A/B/C
My Carrier: Mobile Vikings

Re: navigationPane issue: when multiple pages are opened how do I show one that is not visible?

[ Edited ]

Normally, you don't have to do this. Because navigationPane.push() will add the screen you give to the top of the stack. Which means that view will be appear on top.

Normally the navigateTo, is more when you want to add more than one view to the stack.

Maybe this site can explain it better than I can :-)



A like is always appreciated,
but a nomination for BB Elite even more :-)
You can also contact me on Twitter: @ndsmyter
Contributor
Posts: 12
Registered: ‎08-24-2012
My Device: Bold9780, PlayBook, Dev Alpha
My Carrier: Vodafone

Re: navigationPane issue: when multiple pages are opened how do I show one that is not visible?

Thanx,

 

I did move the attached object code outside of the actionmenu. Will move it back and watch the change in behavior.