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
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers
Accepted Solution

TabbedPane question

Probably and easy +1 for someone out there, but what can I trigger the first time my app start on the first tab ?

 

Let me explain, when my app start I need to call a function in C++ to execute something, for the other that I can use the onTriggered: {}. The first tab isn't triggered I think it's just selected by default.

 

Thank you

Please use plain text.
Developer
shahumang8
Posts: 600
Registered: ‎08-09-2010
My Device: Not Specified

Re: TabbedPane question

Hi,

 

  Into tab there are one method onCreationCompleted() so write code into this function.

 

  

 

-------------------------------------------------------------------------------

 

feel free to press the like button on the right side to thank the user that helped you.

Please use plain text.
Developer
bcs925
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: TabbedPane question

Could do something like having some variable equal to 0 and run that function if that variable is 0.  Then as a part of that function change that variable to 1 and use qsettings to save the value of that variable.  Now the next time you open the app that funciton wont run because the variable has been saved to be equal 1.

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers

Re: TabbedPane question

Yeah that could be an option.

 

The onCreationComplete never gets fired for me, I have no clue why, maybe because the app starts on that tab... I might be wrong.

Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: TabbedPane question

onCreationCompleted always works for me as I have similar functions as yours. If you can show your qml source code snippet, it will be quickly checked. thanks




p(^_^)q
Good good study, day day up
Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers

Re: TabbedPane question

Ok does it have to be on the TabbedPane or the Tab ?

 

This is my code

 

// Default empty project template
import bb.cascades 1.0
import bb.data 1.0

TabbedPane {
    Menu.definition: MenuDefinition {
        actions: [
            ActionItem {
                title: "Refresh"
            }
        ]
    }
    showTabsOnActionBar: true
    Tab {
        title: qsTr("Employee")
        imageSource: "asset:///images/Body.png"
        NavigationPane {
            id: employeePane
            Page {
                id: employeeFeed
                ListView {
                    objectName: "employeeView"
                    id: employeeView
                    listItemComponents: [
                        ListItemComponent {
                            type: "item"
                            DetailFeed {
                            }
                        }
                    ]
                    attachedObjects: [
                        ListScrollStateHandler {
                            id: scrollstatehandler
                            
                            onScrollingChanged: {
                                if (atEnd) {
                                    
                                }
                            }
                        }
                    ]
                }
            }
            attachedObjects: [
                ActivityIndicator {
                    objectName: "indicator"
                    verticalAlignment: VerticalAlignment.Center
                    horizontalAlignment: HorizontalAlignment.Center
                    preferredHeight: 200
                    preferredWidth: 200
                }
            ]
        }
        onCreationCompleted: {
            employee.GetDetail("91258")
        }
    }
    Tab {
        title: qsTr("PhoneDirectory")
        imageSource: "asset:///images/Star.png"
        Page {
        }
    }
}
Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: TabbedPane question

[ Edited ]

Ok. I see. The onCreationCompleted should be put outside of tab but within TabbedPane.

 

If you want to load the data for any tab, you can code a javascript function in that tab and call that function in the onCreationCompleted. Say,

TabbedPane { 
    Tab {
        TabABC{
            id: tabxxx
        }
    }
    onCreationCompleted: {
        tabxxx.reloadData();
    }
}

 




p(^_^)q
Good good study, day day up
Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers

Re: TabbedPane question

Oh ok.

 

Thank you

Please use plain text.