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
nhuanvd
Posts: 20
Registered: ‎12-11-2012
My Device: Blackberry Z10
My Carrier: Viettel

NavigationPane: more than 2 screen in stack ??

I have 3 file. I can Push the second page from the first page. How can i push the third page from page 2?

first.qml. Thanks

import bb.cascades 1.0

NavigationPane {
    id: nav
    Page {
        TextField {
            text: "First Page"
        }
        actions: [
            ActionItem {
                title: "Next Page"
                ActionBar.placement: ActionBarPlacement.OnBar
                onTriggered: {
                    var page = page2Definition.createObject();
                    nav.push(page);
                }
                attachedObjects: ComponentDefinition {
                    id: page2Definition;
                    source: "second.qml"
                }
            }
        ]
    }
}

 second.qml

    Page {
        TextField {
            text: "Second Page"
        }
        actions: [
            ActionItem {
                title: "Next Page"
                ActionBar.placement: ActionBarPlacement.OnBar
                onTriggered: {
                    var page = page3Definition.createObject();
                    nav.push(page);
                }
                attachedObjects: ComponentDefinition {
                    id: page3Definition;
                    source: "second.qml"
                }
            }
        ]
    }

 third.qml

    Page {
        TextField {
            text: "Third Page"
        }
    }

 

Please use plain text.
Developer
contryboy
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: NavigationPane: more than 2 screen in stack ??

I do not know how to achieve it in qml, but using c++ should be easy. You can keep the navigationPane object, and always push pages into the navigationPane.

Dong
Please use plain text.
Contributor
jeetak47
Posts: 13
Registered: ‎10-05-2012
My Device: BB 10 dev Alpha
My Carrier: BSNL

Re: NavigationPane: more than 2 screen in stack ??

@nhuanvd  this very common practice in cascades you can find example in sample cascades applications on github

 I will show how exactly qml look.

 

first.qml


 

import bb.cascades 1.0

NavigationPane {
    id: nav
    Page {
        TextField {
            text: "First Page"
        }

    attachedObjects: [
        ComponentDefinition {
                    id: page2Definition
                    source: "second.qml"
                }
        ]


        actions: [
            ActionItem {
                title: "Next Page"
                ActionBar.placement: ActionBarPlacement.OnBar
                onTriggered: {
                    var page = page2Definition.createObject();
                    nav.push(page);
                }
                
            }
        ]
    }
}


second.qml


Page {
        TextField {
            text: "Second Page"
        }

    attachedObjects: [
        ComponentDefinition {
                    id: page3Definition
                    source: "third.qml"
                }

               ]
        actions: [
            ActionItem {
                title: "Next Page"
                ActionBar.placement: ActionBarPlacement.OnBar
                onTriggered: {
                    var page = page3Definition.createObject();
                    nav.push(page);
                }
                
            }
        ]
    }


third.qml


Page {
        TextField {
            text: "Third Page"
        }
    }


if get stuck use console.debug();  for getting qml messages use slog2info from terminal.

Please use plain text.