Created
June 27, 2012 01:51
-
-
Save ryugoo/3000789 to your computer and use it in GitHub Desktop.
Inspect "[ERROR] Adding an event listener to a proxy that isn't already in the context"
This file contains 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
do -> | |
tabGroup = Ti.UI.createTabGroup() | |
# Tab params | |
tabParam = [{ | |
title: "Left" | |
window: Ti.UI.createWindow | |
title: "Left" | |
backgroundColor: "#FFFFFF" | |
}, { | |
title: "Right" | |
window: Ti.UI.createWindow | |
title: "Right" | |
backgroundColor: "#FFFFFF" | |
}] | |
### | |
内包表記で書くとエラーが出る | |
### | |
# tabGroup.containingTabs = (Ti.UI.createTab val for val in tabParam) | |
# tabGroup.addTab tabGroup.containingTabs[idx] for val, idx in tabGroup.containingTabs | |
### | |
内包表記を使わずに、ばらして書いてもエラーが出る | |
### | |
# tab0 = Ti.UI.createTab tabParam[0] | |
# tab1 = Ti.UI.createTab tabParam[1] | |
# tabGroup.containingTabs = [tab0, tab1] | |
# tabGroup.addTab tabGroup.containingTabs[0] | |
# tabGroup.addTab tabGroup.containingTabs[1] | |
### | |
素直に書けばエラーが出ない | |
### | |
tab0 = Ti.UI.createTab tabParam[0] | |
tab1 = Ti.UI.createTab tabParam[1] | |
tabGroup.tab0 = tab0 | |
tabGroup.tab1 = tab1 | |
tabGroup.addTab tabGroup.tab0 | |
tabGroup.addTab tabGroup.tab1 | |
# Open | |
tabGroup.setActiveTab 0 | |
tabGroup.open() | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment