I was reading the APIs but I had trouble fully understanding it. My problem is that when you touch the textfields located near the bottom of the screen, the keyboard appears on the device and actually covers the textfield you chose to edit. This leaves me blindly typing something into the textfield. I’m thinking native.setKeyboardFocus will “focus” on the textfield I’m interested in and fix the problem but I’m also not sure if by focus they mean that the vertical flashing line (sorry I don’t know the proper name) will go to another textfield automatically upon “ended” phase. At least this is how they used it in the API example.
http://docs.coronalabs.com/api/library/native/setKeyboardFocus.html
When I try it in the simulator, I have multiple textFields going to a single listener function and I’m trying to focus the on the textfield that was touched.
[lua] local function boxHandler (event)
if ( “began” == event.phase ) then
native.setKeyboardFocus( event.target )
print (event.target)
event.target.text = “”
elseif ( “submitted” == event.phase ) then
– Hide keyboard
native.setKeyboardFocus( nil )
end
end[/lua]
and the terminal gives me this.
[lua] 2012-11-20 17:55:43.794 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.797 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.801 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.806 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.829 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.845 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.849 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.864 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.871 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.897 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.912 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.915 Corona Simulator[4244:903] table: 0x11aa471f0
2012-11-20 17:55:43.929 Corona Simulator[4244:903] table: 0x11aa471f0[/lua]
Can anyone help?
Thanks in advance!
[import]uid: 35535 topic_id: 33196 reply_id: 333196[/import]
[import]uid: 35535 topic_id: 33196 reply_id: 131883[/import]