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
Regular Contributor
Posts: 83
Registered: ‎07-19-2012
My Device: Bold 9790, Dev Alpha A
My Carrier: Koodo

Navigating Through Stacks with Pages

Hey All,

I've been experiencing a problem when navigating in a NavigationPane with pages after they have been pushed and then popped. I even tried using the code examples provide here and I still get the same problem

 

import bb.cascades 1.0
 
NavigationPane {
    id: navigationPane
    Page {
        content: Container {
            Button {
                text: "Display first Page"
                 
                onClicked: {
                    navigationPane.push (firstPage);
                }
            }
             
            Button {
                text: "Display second Page"
                 
                onClicked: {
                    navigationPane.push (secondPage);
                }
            }
        } // end of Container
    } // end of Page
     
    attachedObjects: [
        Page {
            id: firstPage
            content: Container {
                Label {
                    text: "First attachedObjects Page"
                }
            }
             
            // Override the default back button to just pop the current
            // screen off of the stack, instead of pop and delete
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    onTriggered: {
                        navigationPane.pop ();
                    }
                }
            }
        },
        Page {
            id: secondPage
            content: Container {
                Label {
                    text: "Second attachedObjects Page"
                }
            }
             
            // Override the default back button to just pop the current
            // screen off of the stack, instead of pop and delete
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    onTriggered: {
                        navigationPane.pop ();
                    }
                }
            }
        } // end of Page
    ] // end of attachedObjects list
} // end of NavigationPane

 

After a page is pushed to the top and then popped to go back to the original page, I cannot push it back to the top again. The button that functioned as the initiator for this push action no longer does anything...anyone else experiencing this? Maybe it's a problem with the simulator -> at least I hope it is!

Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: Navigating Through Stacks with Pages

I copy/pasted your code into my IDE (Beta2) and the buttons didn't work at all...

 

But heres what I do and it works great for me (also described on the link you provided) that sounds like what you are trying to accomplish... I use navigationPane.deprecatedPushQmlByString(); which calls another qml file.  I like using this because it keeps the main.qml less cluttered...

 

main.qml:

import bb.cascades 1.0
 
NavigationPane {
    id: navigationPane
    Page {
        content: Container {
            Button {
                text: "Display first Page"
                 
                onClicked: {
                    navigationPane.deprecatedPushQmlByString("firstPage.qml"); 
                }
            }
             
            Button {
                text: "Display second Page"
                 
                onClicked: {
                    navigationPane.deprecatedPushQmlByString("secondPage.qml");
                }
            }
        } // end of Container
    } // end of Page
} // end of NavigationPane

 

firstPage.qml:

import bb.cascades 1.0

Page {
    content: Label {
        text: qsTr("Hello from First page")
    }
}

 

secondPage.qml:

import bb.cascades 1.0

Page {
    content: Label {
        text: qsTr("Hello from Second page")
    }
}

 

This also has all the defaults of Navigation Pane, so firstPage and secondPage will have the "back" button on the left side of the action bar and doesnt delete pages on pop.

 

This help?  If not I'll take a look more at your provided example to try to get that working.

 

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Highlighted
Regular Contributor
Posts: 83
Registered: ‎07-19-2012
My Device: Bold 9790, Dev Alpha A
My Carrier: Koodo

Re: Navigating Through Stacks with Pages

I had originally tried that method and I was having trouble getting the right navigation flow going because I often have 3 or levels of pages to push from the root. On top of that I noticed in the API document reference for depreciatedPushQmlByString() that it's only a temporary method and it's going to be changed in the future (see here).

Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: Navigating Through Stacks with Pages

I wouldnt worry too much about them changing that particular API, I'm sure they will only slightly change the name and perhaps a syntax change (probably to allow more functionality, rather than removing what it already does).

However I can confirm that using the first sample code in the Creating a stack of screen documentation page only allows the button to be pushed once then stops responding.  I am using the simulator as well.

May be best to wait till end of Sept for when they said API's will be final and instead focus on each indvidual "page" and worry about tying it all together later. 

 

I think they are moving more towards the format of deprecatedPushQmlByString () too keep the main.qml clutter free.  Kind of like the Tabbed Pane where you call "Tab{}"  with pages (or a .qml call) inside of the Tab{}, rather than having a list of page after page after page each with "paneProperties: TabbedPaneProperties {}".  (Just a guess though.)

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
New Contributor
Posts: 5
Registered: ‎08-24-2012
My Device: BB10 Alpha
My Carrier: Developer

Re: Navigating Through Stacks with Pages

Facing the same issue as CrozyBB. I have tried using navigationPane.deprecatedPushQmlByString(); but in the application for some cases i dont need the user to press the back key. Is there a way i could pop the page from the stack without losing the functionality, no matter how many times i navigate ?