1
votes

How to call a screen while clicking a button in Blackberry 10 cascades? I have tried this code but it's not working,

Button {
  text: "Sign-in"
  onClicked: main.qml
}

Can any one send me some sample codes, for on-click function?

Thanks

1
This is not exactly an "onClick" function, but I suppose you're trying to do this?Dielson Sales

1 Answers

1
votes

To show a new Page you'll need to define a NavigationPane and push the Page onto that. Example:

import bb.cascades 1.0

NavigationPane {
    id: navigationPane
    Page {
        Button {
            text: "Sign-in"
            onClicked: {
                var page = secondPageDefinition.createObject();
                navigationPane.push(page);
            }
            attachedObjects: [
                ComponentDefinition {
                    id: secondPageDefinition
                    source: "DetailsPage.qml"
                }
            ]
        }
    }
}

The nice thing about this is that NavigationPane takes care of the back button automatically for you.

When you create a new BlackBerry Cascades project in Momentics choose the NavigationPane template for something very similar to this.