You could also do with looking into tables, loops and using parameters for IDs etc. For example, this code in test1.lua would do the same job, but saves hundreds of lines and is far easier to edit - say if you decide you don’t like their X position or want to move them closer together.
I can’t test it as I’m not at my dev machine but you get the idea…
[lua]
local textFields = {}
local text = {}
mydata.five = {}
local yGap = 50
local userInput = function (event) – put this function somewhere above createScene
local id = event.target.id
if (event.phase == “ended” or event.phase == “submitted”) then
native.setKeyboardFocus( nil )
mydata.five[id] = event.target.text
end
end
for a = 1 , 23 , 1 do – put this code in createScene
local txt = 1 +( (a- 1 ) \ *5 ) …” -“. .5 +((a- 1 )\ *5 )
local py = Y/ 2 + 150 + (yGap * a)
local t = display.newText(txt, X/ 2 - 85 , py, Arial, 33 )
t:setFillColor( 0 )
scrollView:insert(t)
text[a] = t
local tf = native.newTextField(X/ 2 + 70 , py, 150 , 33 )
tf.inputType = “number”
tf.size = 20
tf.alpha = 0
tf.id = a
scrollView:insert(tf)
transition.to(tf, {time = 1500 , alpha = 1 })
textFields[a] = tf
end
[/lua]