Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top