native.newTextField (textinput) and Storyboard problems

Hi guys!

I’m trying out the storyboard but I have some issues with the native.newTextField. It does not do the transition at all when I change the scene. The field statys static until the new scene was loaded and then removes its self.

I could run var:removeSelf() on exitScene, it is little better but still not what I want. Any suggestion? [import]uid: 106083 topic_id: 18254 reply_id: 318254[/import]

Look at this from the API’s:

Because native textfields are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. For example, while they can be manipulated using display object methods, they always appear above normal display objects. Also, they do not inherit display group properties like isVisible, x, y and alpha. If you need to set display properties on native objects, apply them to the objects directly.

If they are not affected by display groups I think there is no way to use them in the storyboard. [import]uid: 12632 topic_id: 18254 reply_id: 69874[/import]

Well that is really bad. Is there anything else then storyboard for easy scene handling? [import]uid: 106083 topic_id: 18254 reply_id: 69877[/import]

Temporarily fixed by creating the object in scene:enterScene and removing it in exitScene. Not a perfect solutions but doable until we get a textinput widget.

[lua]function scene:enterScene( event )

– Email field
emailField = native.newTextField( 30, startPos, 260, 24, inputListener )
emailField.size = 14
emailField.text = “Email address”
emailField:setTextColor( 120, 120, 120 )
emailField.inputType = “email”

–screenGroup:insert( emailField )

– Password field
passwordField = native.newTextField( 30, startPos+40, 260, 24, inputListener )
passwordField.size = 16
passwordField.inputType = “default”
passwordField.isSecure = true

–screenGroup:insert( passwordField )

print( “1: enterScene event” )

– remove previous scene’s view
storyboard.purgeScene( “signup” )
end

function scene:exitScene( event )

print( “1: exitScene event” )

– remove touch listener for image
image:removeEventListener( “touch”, image )

– Reset input
emailField:removeSelf()
passwordField:removeSelf()

end[/lua] [import]uid: 106083 topic_id: 18254 reply_id: 69882[/import]

Thanks Johantd04 for the hint re removeSelf().

Question:
I’m assuming you set emailField.text = “Email address” as a user prompt, which is what I do.

Since trying to adapt my code using storyboard I’ve not been able to get that cleared when the field gets focus.

If yours does clear can you please share your inputListener.

At the moment I’ve had to resort to starting with a blank field but I’d sure like to go back to the prompt scheme. [import]uid: 6547 topic_id: 18254 reply_id: 99133[/import]

Sorry about the dup, No way to delete a reply I guess? [import]uid: 6547 topic_id: 18254 reply_id: 99134[/import]

This probably needs to be raised as a bug. Whilst the workaround will fix the problem, it would be nice if this was handled by the Storyboard API as with any other display object. [import]uid: 140429 topic_id: 18254 reply_id: 110451[/import]

Also +1 for text input widget [import]uid: 140429 topic_id: 18254 reply_id: 110453[/import]