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: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: Telkomsel
Accepted Solution

How to create Action Item of page dynamically using QML?

Hi I want to create action item of a page dynamically using QML

 

How to do that?

Any example or link that explain this?

 

 

Thanks

Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: How to create Action Item of page dynamically using QML?

I'm afraid that's only possible in C++.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to create Action Item of page dynamically using QML?

Sure you can create an ActionItem dynamically.

 

Page {
    id: page

    Container {
        Button {
            text: "Create Action"
            onClicked: {
                var item = actionTemplate.createObject();
                item.title = "New Action";
                page.addAction(item, ActionBarPlacement.OnBar);
            }
        }
    }

    attachedObjects: [
        ComponentDefinition {
            id: actionTemplate
            ActionItem {
                title: 'default'
                onTriggered: {
                    print('dynamic action item created');
                }
            }
        }
    ]
}

 


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: Telkomsel

Re: How to create Action Item of page dynamically using QML?

Thanks peter for your answer,

 

I'm create it using c++ though

from another thread: I got the answer

 

http://supportforums.blackberry.com/t5/Cascades-Development/How-to-create-Action-Item-dynamically/td...