Created
May 24, 2011 01:49
-
-
Save jonalter/988014 to your computer and use it in GitHub Desktop.
currentTab workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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