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
Posts: 101
Registered: ‎01-06-2014
My Device: Q10
Accepted Solution

Push page from Actions list

How can I push a QML page when the user taps on an action item?

 

    actions: [
        ActionItem {
            title: "Item"
            onTriggered: {
            }
        }
    ]

 

Developer
Posts: 158
Registered: ‎01-03-2013
My Device: n/a

Re: Push page from Actions list

If you're using a NavigationPane here you have an example to how to push a qml in the stack from an actionItem.

 

https://developer.blackberry.com/native/reference/cascades/bb__cascades__navigationpane.html?f=navig...

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10

Re: Push page from Actions list

I'm not as I am using a page that is already with a navigation pane.
Developer
Posts: 158
Registered: ‎01-03-2013
My Device: n/a

Re: Push page from Actions list

Show us the full code.

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10

Re: Push page from Actions list

Sure - attached:

import bb.cascades 1.2

Page {
    Container {    
        background: Color.Black 
    }
    actions: [
        ActionItem {
            title: "Item 1"
            imageSource: "asset:///images/emptypixel.png"
            onTriggered: {
                
            }
        }
    ]
}

 

Developer
Posts: 158
Registered: ‎01-03-2013
My Device: n/a

Re: Push page from Actions list

Here you are:

 

  import bb.cascades 1.2


  Page {
    Container {    
        background: Color.Black 
    }
    actions: [
        ActionItem {
            title: "Item 1"
            imageSource: "asset:///images/emptypixel.png"
            onTriggered: {
                var theSecond = secondPage.createObject();
		the_id_of_navigationPane.push(theSecond);
            }
        }
    ]
    attachedObjects: ComponentDefinition {
	id: secondPage
	source: "mysecondpage.qml"
    }
  } 

 

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10

Re: Push page from Actions list

Brilliant, it worked! Many thanks.

Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10

Re: Push page from Actions list

How can I use another component definition for a third page?

Developer
Posts: 158
Registered: ‎01-03-2013
My Device: n/a

Re: Push page from Actions list

attachedObjects property is an array so you can write the following:

 

 import bb.cascades 1.2


  Page {
    Container {    
        background: Color.Black 
    }
    actions: [
        ActionItem {
            title: "Item 1"
            imageSource: "asset:///images/emptypixel.png"
            onTriggered: {
                var theSecond = secondPage.createObject();
		the_id_of_navigationPane.push(theSecond);
            }
        }
    ]
    attachedObjects: [
     ComponentDefinition {
	id: secondPage
	source: "mysecondpage.qml"
     },
     ComponentDefinition {
        id: thirdPage
        source: whatever
     }
    ]
  } 

 

Regards.

If my answer has been useful to you, please, click the button