Skip to content

Instantly share code, notes, and snippets.

@JoshMock
Created November 16, 2010 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshMock/701482 to your computer and use it in GitHub Desktop.
Save JoshMock/701482 to your computer and use it in GitHub Desktop.
Sample Titanium App - Wikipedia search
// 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