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: 18
Registered: ‎05-06-2013
My Device: BB Z10
My Carrier: AXIS
Accepted Solution

first Page actions not visible inside TabbedPane

Hello,

 

My app use TabbedPane in main.qml, and each Tab content is a Page(from qml file).

 

main.qml:

TabbedPane {
    id: tabbedPane
    showTabsOnActionBar: false
    
    tabs: [
        
        Tab {
            title: "First Tab"             
            content: firstPageDef.createObject()
        },        
        Tab {
            title: "Second Tab"
            content: secondPageDef.createObject()
        }
    ]
    
    attachedObjects: [       
        ComponentDefinition {
            id: firstPageDef
            source: "firstpage.qml"
        },
        
        ComponentDefinition {
            id: secondPageDef
            source: "secondpage.qml"
        }
    ]

}

 firstpage.qml

Page {    
    actions: [
        ActionItem {
            title: "action 1"
            ActionBar.placement: ActionBarPlacement.OnBar            
        }
    ]
    Container {
    
    }
}

 

secondpage.qml

Page {    
    actions: [
        ActionItem {
            title: "action 2"
            ActionBar.placement: ActionBarPlacement.OnBar            
        }
    ]
    Container {
    
    }
}

 

When it starts, it will show firstpage.qml, but the action "action 1" is not shown. But when I change tab to "Second Tab", the action on secondpage ("action 2") is shown. Change back to "First Tab" and the action "action 1" is visible.

 

Why is that happening? Please share your thoughts Smiley Happy

 

thank you

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: first Page actions not visible inside TabbedPane

The workaround you are using is not good. If you want dynamic tabs then this is the right way

Change your main.qml to this

TabbedPane {
    id: tabbedPane
    showTabsOnActionBar: false
    
    tabs: [
        
        Tab {
            title: "First Tab"
            delegate: Delegate {
                source: "firstpage.qml"
            }
            delegateActivationPolicy: TabDelegateActivationPolicy.ActivateImmediately
        },        
        Tab {
            title: "Second Tab"
            delegate: Delegate {
                source: "secondpage.qml"
            }
            delegateActivationPolicy: TabDelegateActivationPolicy.ActivateWhenSelected
        }
    ]
}

 and for more info read this

http://developer.blackberry.com/native/documentation/cascades/ui/navigation/multiple_screens_tabs.ht...



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 18
Registered: ‎05-06-2013
My Device: BB Z10
My Carrier: AXIS

Re: first Page actions not visible inside TabbedPane

Thank you Benecore!