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
max_b1ack
Posts: 2
Registered: ‎06-12-2012
My Device: PlayBook
My Carrier: WIND
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"
        }
    ] 
}

 

Please use plain text.
Developer
simon_hain
Posts: 15,855
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

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
Please use plain text.
New Contributor
max_b1ack
Posts: 2
Registered: ‎06-12-2012
My Device: PlayBook
My Carrier: WIND

Re: Navigation Question

Thank you, feeling silly now.

Please use plain text.