So I want to create a custom text field, the one with a little bit of design. I created a display text inside a image rect to create a fake native text field. And attach a touch listener to it that would set the focus of the native keyboard to a native textField that is outside the screen. But I am encountering a problem in focusing the keyboard. It only sets it focus on the native textField if its inside the screen. Hmm what seems to be the problem? Heres a bit of my code:
local function nativeListener1( event ) if event.phase == "began" then print("BEGAN TEXT") nativeUsername.text = userFieldText.text elseif event.phase == "editing" then nativeUsername.text = userFieldText.text elseif event.phase == "ended" or event.phase == "submitted" then nativeUsername.text = userFieldText.text print( "END TEXT -\> FAKE -\> " .. userFieldText.text .. " NATIVE -\> " .. nativeUsername.text) end end local function onFieldListener( event ) if event.phase == "began" then if event.target.id == "user" then print("TOUCH --\> username") native.setKeyboardFocus( nativeUsername ) elseif event.target.id == "pass" then print("TOUCH --\> password") native.setKeyboardFocus( nativePassword ) elseif event.target.id == "fb" then print("TOUCH --\> fb login") checkFbLogin() end end end nativeUsername = native.newTextField( 0, 0, 200, 40 ) nativeUsername:setReferencePoint( display.TopLeftReferencePoint ) nativeUsername.x , nativeUsername.y = display.contentWidth, display.contentHeight
Thanks in advance!