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
behrk2
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

Referencing the parent navigationPane for push()

[ Edited ]

Hello,

 

I have a NavigationPane with an external QML page as an attachedObject that I push on screen after a button click.  Within the new page, I want to push another external QML page (that is an attachedObject) onto the navigationPane.  How can I reference the NavigationPane from the second pushed page?  Using the id doesn't work.  Here is some code:

 

NavigationPane:

NavigationPane {
    id: navigationPane
    Page {
        Container {
            Label { 
                text: "First page"
            }
        }
    }
attachedObjects: [ SecondPage { id: secondPage }

] // This gets called on a button click function pushSeconPage() { navigationPane.push(secondPage); } }

 SecondPage.qml

Page {
    Container {
        Label { 
            text: "Second page"
        }
    }
    attachedObjects: [
        ThirdPage {
            id: thirdPage
        }
    ]
    function pushThirdPage() {
        // How can I reference the original navigationPane to push the 
        // third page? This doesn't work...
        navigationPane.push(thirdPage)
    }
}

 I tried adding ThirdPage as an attachedObject in the original navigationPane (rather than have it defined as an attachedObject in secondPage), but this did not work either.

Please use plain text.
Developer
Zmey
Posts: 1,510
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Referencing the parent navigationPane for push()

Hi,

Assign an id to SecondPage and it's parent will be the NavigationPane:

secondPageId.parent.push(thirdPage)

Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
behrk2
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: Referencing the parent navigationPane for push()

Perfect, thanks so much!

Please use plain text.