native.newTextField() with storyboard

Hello!

I’m having problems using the native.newTextField() widget with the tab bars. In my scene - screen2.lua, I create the widget in the scene:enterScene(event) function and on scene:exitScene(), I remove the widget. This works great when I leave the tab and go to a different tab. However, if I tap on the same tab of screen2.lua, the widget does not reload!

If newTextField() widget exists in screen2.lua, how do I get this widget to ‘stay’ when I reload screen2.lua? I hope this make sense…

Below isn’t the full code, but it’s what I’m essentially doing in screen2.lua.

[code]
function scene:enterScene( event )
userinput = native.newTextField(0,0,75,30)
end
scene:addEventListener( “enterScene”, scene)

function scene:exitScene( event )
local group = self.view
display.remove(userinput)
end

scene:addEventListener( “exitScene”, scene )
[/code] [import]uid: 221388 topic_id: 35542 reply_id: 335542[/import]

If you’re on the scene you are already on, shouldn’t your text fields still be there because in theory nothing should happen. If you need the tabBar press to reload the scene, consider some logic in the press handler that would say if this is the current scene, call reloadScene() instead of gotoScene().
[import]uid: 199310 topic_id: 35542 reply_id: 141337[/import]

If you’re on the scene you are already on, shouldn’t your text fields still be there because in theory nothing should happen. If you need the tabBar press to reload the scene, consider some logic in the press handler that would say if this is the current scene, call reloadScene() instead of gotoScene().
[import]uid: 199310 topic_id: 35542 reply_id: 141337[/import]

rachelrn83,

I’ve been having a similar problem, so rest assured it isn’t just you. I have been trying to use native.newTextField for a data entry form. When I use this with Director, the columns do not show up the first time I open the scene but they do show up randomly on subsequent tries. For example the first time, no fields, 2nd first two fields show, 3rd none, 4th none, 5th first field. Random. This only occurs on device (Google Nexus 7 and Acer Iconia).

So I switched from Director to Storyboard. Now the fields show up on first try but not on subsequent tries. And I’ve tried both purging and removing but get same results. If you find a solution, please post it here. I’ll do the same.

UPDATE: I closed everything and went back in later in the evening to get sample code for Rob Miracle. The Storyboard version now works as it should. No changes - I have no explanation other than I closed and reopened Corona Project Manager, which I use as my development environment.

@PhillB1 can you post some of your storyboard code like your createScene and ensterScene functions?

rachelrn83,

I’ve been having a similar problem, so rest assured it isn’t just you. I have been trying to use native.newTextField for a data entry form. When I use this with Director, the columns do not show up the first time I open the scene but they do show up randomly on subsequent tries. For example the first time, no fields, 2nd first two fields show, 3rd none, 4th none, 5th first field. Random. This only occurs on device (Google Nexus 7 and Acer Iconia).

So I switched from Director to Storyboard. Now the fields show up on first try but not on subsequent tries. And I’ve tried both purging and removing but get same results. If you find a solution, please post it here. I’ll do the same.

UPDATE: I closed everything and went back in later in the evening to get sample code for Rob Miracle. The Storyboard version now works as it should. No changes - I have no explanation other than I closed and reopened Corona Project Manager, which I use as my development environment.

@PhillB1 can you post some of your storyboard code like your createScene and ensterScene functions?