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 Knowledge Base

Dynamically add a tab into an existing TabbedPane

by Developer on ‎12-06-2013 11:56 AM (1,241 Views)

Question

Dynamically add a tab into an existing TabbedPane.

Answer

TabbedPane {
    id: tabbedPane
    ...
    attachedObjects: [
        ComponentDefinition {
            id: pageDefinition
            source: "asset:///UI.qml"
        }
    ]
    function newTab() {
        var c = "import bb.cascades 1.0; Tab{}";
        var tab = Qt.createQmlObject(c,tabbedPane,"newTab");
        tab.content = pageDefinition.createObject(tab);
        tabbedPane.add(tab);
    }
}
Contributors
Users Online
Currently online: 26 members 824 guests
Please welcome our newest community members: