Change tab
I know using setActiveTab will change it, but what if my tabGroup lives in app.js and I am in a window called create.js and want to change the tab? Is their like a parent method?
3 Answers
-
Like so:
var tabGroup = Ti.UI.currentWindow.tabGroup; //assuming 1 corresponds to the tab you want to switch to tabGroup.setActiveTab(1);
-
Hmm, I haven't done this in my own code, but you could store the tabs as properties of the tabGroup object, so they become accessible to any window.
var myTab= Ti.UI.createTab({...}); tabGroup.myTab = myTab; ...in some other file... var tabGroup = Ti.UI.currentWindow.tabGroup; tabGroup.setActiveTab(tabGroup.myTab);
Maybe there's a better way, though.
-
Ok that works. How can I pass the object rather than a number? I'd rather call it by the name. tabGroup.setActiveTab(tabName);