TabBar, buttons and pages

New to mobile device development and I have been learning corona and using the sample code that is provided. I have setup an app using the TabBar sample which uses a different .lua file for each tab. I have added a button to one of the tabs and then running into two issues.

1. When I click the button I'm wanting to pull up another screen that will have some text fields for entering data. I have tried pulling up another .lua file similar to the way the tabs work but that is not working. Can I open another .lua file or should my code remove all the buttons and text and create the fields I want?

2. I'm having trouble removing the button. I have tried using display.remove(buttonName) which works when changing tabs but does not work when I call it inside the function that is called when the button is pressed.

If someone has an idea on direction for either of these it would be appreciated.

Welcome to the fantastic world of corona.

It was not clear from your post what is not working when you pull your lua file containing the textfield. Hope you are aware the native textfields are not visible on emulator for stable builds(only subscriber builds allow emulator to show native textfields)

Posting code could help get some answers for your ur 2nd issue.

thx,
Bejoy

The first issue I'm having is that I'm unable to load the second lua file when I click the button. The tabs are using a loadScreen function in main.lua which looks like.

local function loadScreen(newScreen)
if currentScreen then
currentScreen:cleanUp()
end
currentScreen = require(newScreen).new()
tabView:insert(currentScreen)

return true
end

I'm trying to call the same function on button release and getting an error in the simulator saying "attempt to call global 'loadScreen' (a nil value). Confused why this works with tabs but not a button.

If the loading of a new lua file will work then I am able to remove the button so my second issue won't matter.

Thanks,
Dave

views:1406 update:2011/11/5 17:18:39
corona forums © 2003-2011