Created
March 14, 2012 15:13
-
-
Save egomez99/2037144 to your computer and use it in GitHub Desktop.
APP-988347
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
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
// create tab group | |
var tabGroup = Titanium.UI.createTabGroup(); | |
// create base UI tab and root window | |
// | |
tabGroup.addEventListener('focus',function(e){ | |
win1.orientationModes=[ | |
Titanium.UI.PORTRAIT, | |
Titanium.UI.LANDSCAPE_LEFT, | |
Titanium.UI.LANDSCAPE_RIGHT | |
]; | |
}); | |
var win1 = Titanium.UI.createWindow({ | |
title:'Tab 1', | |
backgroundColor:'#fff' | |
}); | |
win1.orientationModes=[ | |
Titanium.UI.PORTRAIT, | |
Titanium.UI.LANDSCAPE_LEFT, | |
Titanium.UI.LANDSCAPE_RIGHT | |
]; | |
var tab1 = Titanium.UI.createTab({ | |
icon:'KS_nav_views.png', | |
title:'Tab 1', | |
window:win1 | |
}); | |
gl = {}; | |
var label1 = Titanium.UI.createLabel({ | |
color:'#999', | |
text:'I am Window 1', | |
font:{fontSize:20,fontFamily:'Helvetica Neue'}, | |
textAlign:'center', | |
width:'auto' | |
}); | |
var winTxtField = Titanium.UI.createTextField({ | |
color:'#ff7c00', | |
font: { | |
fontSize:16, | |
fontWeight:'bold', | |
fontFamily:'Helvetica Neue' | |
}, | |
top:9, | |
textAlign : 'right', | |
height:46, | |
bottom:15, | |
keyboardType:Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION, | |
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
borderColor:'blue', | |
borderWidth:2 | |
}); | |
Ti.include('win2.js'); | |
winTxtField.addEventListener('blur',function(){ | |
gl.createNewWindow(); | |
}); | |
win1.add(winTxtField); | |
/* | |
win1.addEventListener('focus', function(){ | |
winTxtField.focus();//enable the listener for our TxtField | |
});*/ | |
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
gl.createNewWindow = function(){ | |
var win2 = Titanium.UI.createWindow({ | |
title:'I am window2', | |
backgroundColor:'blue' | |
}); | |
win2.orientationModes=[ | |
Titanium.UI.LANDSCAPE_LEFT, | |
Titanium.UI.LANDSCAPE_RIGHT | |
]; | |
win2.open(); | |
win2.addEventListener('click',function(e){ | |
//winTxtField.focus();//don't need this | |
//Ti.UI.orientation = Ti.UI.PORTRAIT;//if you need to update to PORTRAIT mode | |
//Ti.Android.currentActivity.setRequestedOrientation(Ti.Android.SCREEN_ORIENTATION_PORTRAIT); | |
Ti.UI.orientation = Titanium.Gesture.orientation; | |
win2.close(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment