Created
November 16, 2010 05:29
-
-
Save JoshMock/701482 to your computer and use it in GitHub Desktop.
Sample Titanium App - Wikipedia search
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 base UI tab and root window | |
var window = Titanium.UI.createWindow({ | |
title:'Search', | |
backgroundColor:'#fff' | |
}); | |
var textfield = Titanium.UI.createTextField({ | |
color:'#336699', | |
height:35, | |
top:10, | |
left:10, | |
width:250, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED | |
}); | |
var button1 = Titanium.UI.createButton({ | |
title:'go', | |
top:50, | |
left:10 | |
}); | |
button1.addEventListener('click', function() { | |
doSearch(); | |
}); | |
var doSearch = function() { | |
searchTerm = textfield.value; | |
textfield.blur(); | |
var webview = Titanium.UI.createWebView({url: 'http://en.wikipedia.org/wiki/' + searchTerm}); | |
window.add(webview); | |
}; | |
window.add(textfield); | |
window.add(button1); | |
window.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment