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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
Kaz32
Posts: 145
Registered: ‎11-24-2012
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

Please use plain text.
Developer
zezke
Posts: 820
Registered: ‎12-12-2010
My Carrier: Mobile Vikings

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

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

-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Developer
peter9477
Posts: 5,630
Registered: ‎12-08-2010
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 -- (PlayBook 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!
Please use plain text.
Developer
Kaz32
Posts: 145
Registered: ‎11-24-2012
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...

 

Please use plain text.