Switch from one window/tab to another
I have three main windows in a tab group. Let's call one login, implemented in login.js, and another main, implemented in main.js .
On successful login, I'd like to make the main window (tab) active. That is, from within login.js, I'd like to switch to main.js .
It looks like the globals I've defined in app.js (eg. the tabgroup variable) are not available to me in login.js, so how do I switch tabs?
1 Answer
-
Accepted Answer
You should be able to get the tabGroup from the current window. Once you have that, you can use the setActiveTab function, like so:
var tabGroup = Ti.UI.currentWindow.tabGroup; //assuming 1 corresponds to your "main" tab tabGroup.setActiveTab(1);