02-24-2013 11:35 PM
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
Solved! Go to Solution.
02-25-2013 12:27 AM
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.
02-25-2013 10:29 AM
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.
02-25-2013 11:08 AM
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.
02-25-2013 11:13 AM
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
02-25-2013 01:16 PM
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 {
}
}
}
02-25-2013 01:22 PM - edited 02-25-2013 01:28 PM
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();
}
}
02-25-2013 02:06 PM
Oh ok.
Thank you