If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Contributor
vdveld
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

 

 

 

Please use plain text.
Developer
ndsmyter
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
Please use plain text.
Contributor
vdveld
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.

 

 

Please use plain text.