Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked September 29th 2010 by Parand Darugar
  • mobile
  • tabgroup
0 Comments

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);
    
    — answered September 29th 2010 by Mike Dosey
    permalink
    1 Comment
    • Thanks Mike.

      — commented September 29th 2010 by Parand Darugar
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.