Created
June 6, 2011 21:20
-
-
Save pec1985/1011136 to your computer and use it in GitHub Desktop.
Previous and Next on textFields
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
var win = Ti.UI.createWindow({ | |
backgroundColor:'#ccc' | |
}); | |
var mainView = Ti.UI.createScrollView({ | |
top:0, | |
bottom:0, | |
right:0, | |
left:0, | |
contentWidth:320, | |
contentHeight:'auto', | |
layout:'vertical' | |
}); | |
var prev1 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex1 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next1 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text1 = Ti.UI.createTextField({ | |
value:'text1', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[flex1,next1] | |
}); | |
var prev2 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex2 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next2 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text2 = Ti.UI.createTextField({ | |
value:'text2', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[prev2, flex2,next2] | |
}); | |
var prev3 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex3 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next3 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text3 = Ti.UI.createTextField({ | |
value:'text3', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[prev3, flex3, next3] | |
}); | |
var prev4 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex4 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next4 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text4 = Ti.UI.createTextField({ | |
value:'text4', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[prev4, flex4, next4] | |
}); | |
var prev5 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex5 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next5 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text5 = Ti.UI.createTextField({ | |
value:'text5', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[prev5, flex5, next5] | |
}); | |
var prev6 = Ti.UI.createButton({ | |
title:'prev' | |
}); | |
var flex6 = Ti.UI.createButton({ | |
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var next6 = Ti.UI.createButton({ | |
title:'next' | |
}); | |
var text6 = Ti.UI.createTextField({ | |
value:'text6', | |
height:44, | |
width:300, | |
top:50, | |
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, | |
keyboardToolbar:[prev6] | |
}); | |
mainView.add(text1); | |
mainView.add(text2); | |
mainView.add(text3); | |
mainView.add(text4); | |
mainView.add(text5); | |
mainView.add(text6); | |
next1.addEventListener('click', function(){ | |
text2.focus(); | |
}); | |
next2.addEventListener('click', function(){ | |
text3.focus(); | |
}); | |
next3.addEventListener('click', function(){ | |
text4.focus(); | |
}); | |
next4.addEventListener('click', function(){ | |
text5.focus(); | |
}); | |
next5.addEventListener('click', function(){ | |
text6.focus(); | |
}); | |
prev2.addEventListener('click', function(){ | |
text1.focus(); | |
}); | |
prev3.addEventListener('click', function(){ | |
text2.focus(); | |
}); | |
prev4.addEventListener('click', function(){ | |
text3.focus(); | |
}); | |
prev5.addEventListener('click', function(){ | |
text4.focus(); | |
}); | |
prev6.addEventListener('click', function(){ | |
text5.focus(); | |
}); | |
win.add(mainView); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment