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
New Contributor
Posts: 2
Registered: ‎06-12-2012
My Device: PlayBook
Accepted Solution

Navigation Question

Hey all,

 

I am trying to push a new page if a user clicks an image... should be straight forward right?

 

tried with a button as well... am I missing something?

 

import bb.cascades 1.0

NavigationPane {
    id: navPane
    backButtonsVisible: false
    
Page {
    Container {
       layout: DockLayout {}
       Button {
            id: page2button
            onClicked: {
                navPane.push(page2);
            }
        }
        ImageButton {
            id: page3button
            onTouch:  {
                    navPane.push(page3);
            }
        }
    }
    attachedObjects: [
        ComponentDefinition {
            id: page2
            source: "pg3.qml"
        },
        ComponentDefinition {
            id: page3
            source: "p3.qml"
        }
    ] 
}

 

Developer
Posts: 16,575
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Navigation Question

welcome to the support forums.

If you use a ComponentDefinition you have to create the object first.
In your case it would be:
navPane.push(page2.createObject());
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 2
Registered: ‎06-12-2012
My Device: PlayBook

Re: Navigation Question

Thank you, feeling silly now.