Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created May 24, 2011 01:49
Show Gist options
  • Select an option

  • Save jonalter/988014 to your computer and use it in GitHub Desktop.

Select an option

Save jonalter/988014 to your computer and use it in GitHub Desktop.
currentTab workaround
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
title: 'Win 1',
url: 'win1.js'
});
var tab1 = Ti.UI.createTab({
title: 'Tab 1',
window: win1
});
// pass a reference of the current tab to the window
win1.tab = tab1;
tabGroup.addTab(tab1);
tabGroup.open();
var win = Ti.UI.currentWindow;
// get the reference to the tab here
var tab = win.tab;
win.backgroundColor = 'red';
var button1 = Ti.UI.createButton({
title: "open window",
height: 40,
width: 200,
top: 100
});
button1.addEventListener('click', function(e){
var win2 = Ti.UI.createWindow({
backgroundColor: 'blue'
});
tab.open(win2);
});
win.add(button1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment