I hope someone can help me! If you can run this and tell me why it is only FULLY WORKING for first Field.
supportedOrientations(LANDSCAPE_ANY)
function setup()
Fields = {"Patient's Name:","Date Of Birth:","Sexe:","School/Rehabilitation Center:","Grade:","Examiner's eMail:"}
inp = 0
str = ""
input={}
y = 0
end
function draw()
pushStyle()
background(255,255,255,255)
fill(0,0,0,255)
textAlign(LEFT)
fontSize(22)
font("TimesNewRomanPSMT")
text("Patient's ID",WIDTH/3,HEIGHT-50)
for i = 1,6 do
text(Fields[i],200,HEIGHT-(i*100))
end
for i = 1,6 do
noFill()
strokeWidth(2)
stroke(0, 0, 0, 255)
rect(400,HEIGHT-(i*100)-75/2,500,50)
end
fill(255, 255, 255, 255)
for i = 1,6 do
rect(400,HEIGHT-(i*100)-75/2,500,50)
end
fill(0, 0, 0, 255)
if keyboardBuffer() ~= nil then
text(keyboardBuffer(),650,y+25)
else
text(str,650,y+25)
end
if input[1] ~= nil then text(input[1],650,HEIGHT-275/2 + 15) else
if input[2] ~= nil then text(input[2],650,HEIGHT-475/2 + 15) else
if input[3] ~= nil then text(input[3],650,HEIGHT-675/2 + 15) else
if input[4] ~= nil then text(input[4],650,HEIGHT-875/2 + 15) else
if input[5] ~= nil then text(input[5],650,HEIGHT-1075/2 + 15) else
if input[6] ~= nil then text(input[6],650,HEIGHT-1275/2 + 15) else
end end end end end end
popStyle()
end
function touched(tch)
local currentTouchPosition = vec2 (tch.x,tch.y)
if currentTouchPosition.y< HEIGHT- 275/2 + 50 and currentTouchPosition.y > HEIGHT- 275/2 then inp = 1
else if currentTouchPosition.y < HEIGHT- 475/2 + 50 and tch.y > HEIGHT- 475/2 then inp = 2
else if currentTouchPosition.y < HEIGHT- 675/2 + 50 and currentTouchPosition.y > HEIGHT- 675/2 then inp = 3
else if currentTouchPosition.y < HEIGHT- 875/2 + 50 and currentTouchPosition.y > HEIGHT- 875/2 then inp = 4
else if currentTouchPosition.y < HEIGHT- 1075/2 + 50 and currentTouchPosition.y > HEIGHT- 1075/2 then inp = 5
else if currentTouchPosition.y < HEIGHT- 1275/2 + 50 and currentTouchPosition.y > HEIGHT- 1275/2 then inp = 6
end
end
end
end
end
end
local l = 400
local r = 900
local b = HEIGHT-(inp*100)-75/2
local t = HEIGHT-(inp*100)-75/2 + 50
if currentTouchPosition.x > l and currentTouchPosition.x < r then
if currentTouchPosition.y > b and currentTouchPosition.y < t then
showKeyboard()
y = HEIGHT - (inp*100)- 75/2
end
end
end
function keyboard(key) -- move keyboardBuffer to str when return is pressed
if key == RETURN then
str = keyboardBuffer()
input[inp] = str
hideKeyboard()
end
end