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
Highlighted
Developer
Posts: 173
Registered: ‎07-16-2013
My Device: BlackBerry Limited Edition Z10, BlackBerry Playbook
My Carrier: Idea

ActionItem onTriggered not working

I'm using ApplicationMenu in my app for share rating help and settings functionality. I want that whenever user clicks on any icon, a new page gets opened. I've tried all the methods given in the documentation. Somebody please help.

 

Here is a code snippet

 

NavigationPane {
    
    // Add the application menu using a MenuDefinition
                    Menu.definition: MenuDefinition {
                       actions: [
                            ActionItem {
                                title: "Share Via BBM"
                                imageSource: "asset:///images/rateThisApp.png"
                                onTriggered: {}
                            }
] // end of actions list
                                     attachedObjects: [
                          // Create the ComponentDefinition that represents the
                          // custom component in myPage.qml
                          ComponentDefinition {
                              id: registrationPageNavigationPane
                              source: "registration.qml"
                          }
                      ]          
                   } // end of MenuDefinition

 I want that whenever someone clicks on rateThisApp.png registration.qml should open. If the id of 'NavigationPane' of my registration.qml page is registerPageNavigationPane and that of the 'Page' is page, tell me what to edit in the code. Or tell me what to write against the onTriggered attribute.

 

Please reply fast.

Click on Like Button if I helped you. Accept As SolutionIf my response solved your problem.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: ActionItem onTriggered not working

Move the definition out of the menu defintion and do this...

 

Page {


    actions: [
        ActionItem {
            ActionBar.placement: ActionBarPlacement.OnBar
            title: "push page"

            onTriggered: {
                var page = pageDefinition.createObject();
                navPane.push(page);
            }
        }
    ]


        attachedObjects: [
            ComponentDefinition {
                id: pageDefinition

                source: "page.qml"

            }
        ]

    }

}

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 173
Registered: ‎07-16-2013
My Device: BlackBerry Limited Edition Z10, BlackBerry Playbook
My Carrier: Idea

Re: ActionItem onTriggered not working

Didn't worked. Smiley Sad . What if there is NavigationPane instead of Page as I've showed in the code snippet. Would that matter. Coz when I used Sheet, the ActionItem's onTriggered worked. But then in that case as I used Images in Grid template, nothing happened when I clicked the grid images.

Click on Like Button if I helped you. Accept As SolutionIf my response solved your problem.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: ActionItem onTriggered not working

Sorry I didn't have time to sculpt it to your code it should make no difference as long as you have an id for navPane and reference it in the push.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 173
Registered: ‎07-16-2013
My Device: BlackBerry Limited Edition Z10, BlackBerry Playbook
My Carrier: Idea

Re: ActionItem onTriggered not working

The iead you suggested gave me a context menu. I wanted an ApplicationMenu instead. The one on the Top.

Click on Like Button if I helped you. Accept As SolutionIf my response solved your problem.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: ActionItem onTriggered not working

Let's try again...

 

NavigationPane {
    id: navPane

    Menu.definition: MenuDefinition {
        actions: [
            ActionItem {
                title: "Share Via BBM"
                imageSource: "asset:///images/rateThisApp.png"
                onTriggered: 
                     var page = registrationPageNavigationPane.createObject();
                     navPane.push(page); } ] }      attachedObjects: [         ComponentDefinition {     id: registrationPageNavigationPane source: "registration.qml
     }
    ]
}

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 173
Registered: ‎07-16-2013
My Device: BlackBerry Limited Edition Z10, BlackBerry Playbook
My Carrier: Idea

Re: ActionItem onTriggered not working

And here in the AttachedObjects the id would be that of the page and not of the navigationpane of the qml right....?????

Click on Like Button if I helped you. Accept As SolutionIf my response solved your problem.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: ActionItem onTriggered not working

You can use any id you like it should not match any others it is just used to reference the ComponantDefinition when you attach the object in the onTriggered slot.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 173
Registered: ‎07-16-2013
My Device: BlackBerry Limited Edition Z10, BlackBerry Playbook
My Carrier: Idea

Re: ActionItem onTriggered not working

Not working. Smiley Sad

I'm new to qml.

Will you have a look at the qmls whenever you have time if I PM you the qmls

Click on Like Button if I helped you. Accept As SolutionIf my response solved your problem.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: ActionItem onTriggered not working

Sorry I don't have time to handle PM requests.

 

Post the code you have so far here and if I can't look at it someone will.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.