ShowTable of Contents
Set a custom 'click' handler
Example: when user taps on a tabgroup button 'About' then change the window title.
App.tabGroup.addEventListener('focus', function(e) {
if (App.tabGroup.activeTab.title == "About") App.winIPadMain.title = 'Welcome to titaniumwiki.com';
});
Use a tab to do somthing without opening another window
If you want for example open a settings dialog when the user clicks a tab of a tabgroup, you can use a custom 'click' handler like this:
App.tabGroup.addEventListener('focus', function(e) {
if (App.tabGroup.activeTab.title == "Settings") {
// return to the previous tab
App.tabGroup.activeTab = e.previousTab;
// do something
}
});
Open another window in iPhone and iPad
In an application derived from the YouAtNotes Framework template you can open another window in a tabgroup's tab with code similar to this:
if(!YNUI.isIPad()) {
App.tab_content.open(App.window_otherwindow, {
animated : true
});
} else {
// open this window only if needed
if(App.currentContentWindow != "mywindow") {
App.currentContentWindow = "mywindow";
App.tab_content.open(App.window_otherwindow, {
animated : false
});
}
// make sure the first tab of the tabgroup is selected
if(App.tabGroup.activeTab != App.tab_content)
App.tabGroup.setActiveTab(0);
// hide the iPad popup in portrait mode
if(YNUI.isOrientationPortrait()) {
App.splitView.setMasterPopupVisible(true);
App.splitView.setMasterPopupVisible(false);
}
}