Skip to content

Instantly share code, notes, and snippets.

@minhnc
Created February 14, 2012 09:13
Show Gist options
  • Save minhnc/1825022 to your computer and use it in GitHub Desktop.
Save minhnc/1825022 to your computer and use it in GitHub Desktop.
win1.js
var win = Ti.UI.currentWindow;
var tf1 = Titanium.UI.createTextField({
color : '#336699',
height : 35,
top : 100,
// left : 100,
width : 250,
// top : 300, ---
borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(tf1);
var button = Titanium.UI.createButton({
title : 'Save',
top : 200,
width : 100,
height : 50
});
win.add(button);
button.addEventListener('click', function() {
var db = Titanium.Database.open('doctor_names');
db.execute('CREATE TABLE IF NOT EXISTS doctor (id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT)');
db.execute('INSERT INTO doctor (name) VALUES(?)', button.value);
db.close();
Titanium.App.fireEvent('app:clicked');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment