Multiple native.textFields on one screen

I’m building a couple of forms into game I’m building (Login and Registration). The the problem is on the iPhone, the keyboard covers half the screen.

Does anyone know of an easy way to “scroll into view” the fields that are obscured by the keypad?

Many iphone apps seem to support this behavior.

[import]uid: 19626 topic_id: 17014 reply_id: 317014[/import]

I just did this. You have to move them yourself. The fieldHandler gets called when you type in a field and moves them. I know I found this somewhere on the board so credit goes out to the original poster.

[lua]for i=1,8, 1 do
field[i] = native.newTextField( 15, 80, 150, tHeight, fieldHandler(function() return i end) )

end
local function fieldHandler (getObj)
return function (event)
local myObj=getObj()
if ( “began” == event.phase ) then
– This is the “keyboard has appeared” event
if myObj>5 then --only move using if the lower ones >5
for i=1,8, 1 do
if i < 6 then
field[i].y=field[i].y-1200 --move off screen
else
field[i].y=field[i].y-200 – just move up
end
end
end
elseif ( “ended” == event.phase ) then
– This event is called when the user stops editing a field: for example, when they touch a different field
if myObj>5 then
for i=1,8, 1 do
if i < 6 then
field[i].y=field[i].y+1200
else
field[i].y=field[i].y+200
end
end
end
elseif ( “submitted” == event.phase ) then
– This event occurs when the user presses the “return” key (if available) on the onscreen keyboard

– Hide keyboard
native.setKeyboardFocus( nil )
end
end
end[/lua] [import]uid: 65685 topic_id: 17014 reply_id: 63855[/import]

Robmiracle - Do remember that the native textfields are always placed on top of all other graphic objects. Moving them up could position them on top of the navbar(in cases where there many textfields in the forms).

I usually navigate from the parentform and show the textbox in a seperate screen(or popup) and bring the value back to the parent form.

thx,
Bejoy [import]uid: 84539 topic_id: 17014 reply_id: 63859[/import]