what do I need to do

So I have been busting my brains to get my back button to go back and finally it does, but the current screen stays in the background as well. What do I need to do to destroy the background scene as I only want the previous seen to show when user hits the bak button? [import]uid: 69302 topic_id: 30874 reply_id: 330874[/import]

Add it to the same group you’re adding your other images to if using Director or Storyboard, or if not simply remove it using display.remove() or obj:removeSelf()

If that isn’t clear enough post your code, will help :slight_smile: [import]uid: 52491 topic_id: 30874 reply_id: 123461[/import]

Its clear peach , but its not working. I have tried putting the display,remove() and obj:removeSelf() everywhere and it will not go away :(. I just want the previous screen and its button to show when user hit back.
And what was weird was that in order to get the back button to go back I had to name the gotoscene as Scene1, although I named it scene1. is that normal?

-----scene2.lua

[code]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– include Corona’s “widget” library
local widget = require “widget”


– forward declarations and other locals
local playBtn

– ‘onRelease’ event listener for playBtn
local function onButtonEvent()
storyboard.gotoScene( “Scene1”)
return true – indicates successful touch

end

–> Starts our app


– BEGINNING OF YOUR IMPLEMENTATION

– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.


local background = display.newRect(0,0,display.contentWidth,display.contentHeight)
background:setFillColor(0,0,0)

– create a widget button (which will loads scene2.lua on release)
playBtn = widget.newButton{
label=“Go Back”,
labelColor = { default={255}, over={120} },
default=“button.png”,
over=“button-over.png”,
width=100, height=40,
onEvent = onButtonEvent – event listener function

}
playBtn:setReferencePoint( display.TopLeftReferencePoint )
–group:insert( playBtn )
–display.remove(“PickerWheel”)

–end

– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view

– INSERT code here (e.g. start timers, load audio, start listeners, etc.)

end

– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view

– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)

end

– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view

if playBtn then
playBtn:removeSelf()
– widgets must be manually removed
playBtn = nil
end
end

– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view

– create a grey rectangle as the backdrop
local bg = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor( 255 )
group:insert(bg)
bg.x = display.contentWidth * 0.5;
bg.y = display.contentHeight * 0.5;

local font = native.systemFont;
end

local widget = require “widget”
widget.setTheme (“theme_ios”)
– create table to hold all column data
local columnData = {}

– create first column
columnData[1] = { “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December” }
–columnData[1] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12” }
columnData[1].alignment = “right”
columnData[1].width = 120
columnData[1].startIndex = 1

– second column (lots of rows)
columnData[2] = {}
columnData[2].alignment = “center”
for i=1,31 do
columnData[2][i] = i
end
columnData[2].startIndex = 1

– third column
columnData[3] = {}
for i=1,25 do
columnData[3][i] = i+2011
end
columnData[3].startIndex = yearIndex

local picker = widget.newPickerWheel{
id=“myPicker”,
font=“Helvetica-Bold”,
top=50,
columns=columnData
}
local widget = require “widget”
widget.setTheme (“theme_ios”)

– create table to hold all column data
local columnData = {}

– create first column
columnData[1] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12” }
columnData[1].alignment = “right”
columnData[1].width = 120
columnData[1].startIndex = 1

– second column (lots of rows)"
columnData[2] = { “00”,“01”,“02”,“03”,“04”,“05”,“06”,“07”,“08”,“09”,“10”,“11”,“12”,“13”,“14”,“15”,“16”,“17”,“18”,“19”,“20”,“21”,“22”,“23”,“24”,“25”,“26”,“27”,“28”,“29”,“30”,“31”,“32”,“33”,“34”,“35”,“36”,“37”,“38”,“39”,“40”,“41”,“42”,“43”,“44”,“45”,“46”,“47”,“48”,“49”,“50”,“51”,“52”,“53”,“54”,“55”,“56”,“57”,“58”,“59” }
columnData[2].alignment = “center”
for i= 1,59 do
– columnData[2][i] = i
end
columnData[2].startIndex = 1

– third column
columnData[3] = { “AM”, “PM” }
columnData[3].startIndex = 1

– create the actual picker widget with column data
local picker = widget.newPickerWheel{
id=“myPicker”,
font=“Helvetica-Bold”,
top=200,
columns=columnData

}
display.remove(“scene2”)

local label = display.newText(“with the understanding”, 0, 0, font, 18) ;
label:setReferencePoint(display.BottomCenterReferencePoint);
label:setTextColor(255, 255, 255) ;
label.x = display.contentWidth * 0.5;
label.y = display.contentHeight * .95;

function label:tap(e)
native.showAlert(“Tapped”,“with the understanding!”,{“Ok”})
native.showPopup(“sms”,{
–body = “I sent this text from my app”,
–to = {“5550000000”} – or “5550000000” if this doesn’t work
}) ;
end

label:addEventListener(“tap”, label);

system.vibrate()

–end

function time_to_notify(hora_in, minutos_in)
local utcTime = os.date( “!*t”, os.time() )
local timeTable = os.date("*t")
local hora_cl = timeTable.hour
local minuto_cl = timeTable.min

segundos_cl = (hora_cl*60*60)+(minuto_cl*60)
segundos_in = (hora_in*60*60)+(minutos_in*60)

if(segundos_cl>segundos_in)then
seg_reg = 86400 - segundos_cl + segundos_in
end

if(segundos_cl<segundos_in> seg_reg = segundos_in-segundos_cl
end

back = os.date( “!*t”, os.time() + seg_reg )
return back

end



– remove widget first:
display.remove( myWidget )
myWidget = nil



-----------------------------------------------------------------------------------------
– END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched whenever before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )

–scene:addEventListener( “returnScene”, scene )

-----------------------------------------------------------------------------------------

[/code]return scene [import]uid: 69302 topic_id: 30874 reply_id: 123471[/import] </segundos_in>

Uhm, line 75 try inserting background into group? If that fails can you upload zip for me to DL and run? [import]uid: 52491 topic_id: 30874 reply_id: 123491[/import]

So I tried inserting background into group. and it removed 1 of the widgets but not the other and it caused a error:attempt to index global ‘group’ (a nil value) any other suggestions? I am trying to play with it before I cave in and send you the file :slight_smile: [import]uid: 69302 topic_id: 30874 reply_id: 123571[/import]

OK can you try moving background to around line 65, then inserting it in group right after and tell me how that goes, please? [import]uid: 52491 topic_id: 30874 reply_id: 123647[/import]

Ok Peach Pellen, I have given it all I have given that darn back button all I have and it will not function right. please help!!! lol I sent the zip file to your email or what I hope is the right email addy. Im counting on you [import]uid: 69302 topic_id: 30874 reply_id: 123715[/import]

Moving the background like I suggested above worked to remove it, the error then given was about setTextColor - this is in scene1 and is caused by the fact you have several text objects with the same name.

So 1) Give your text objects in scene1.lua unique names
2) move the background to where I mention above and insert it into the group
3) move your text in scene1.lua down to start at line 68/69 or there abouts and also insert it into the group if you don’t want it showing on the screen when you change scenes.

Fix those issues and you’ll be in better shape; still things to do but that seems to be causing the bulk of the issues. It should remove and warnings you are currently getting.

Let me know how you get on.

Peach :slight_smile: [import]uid: 52491 topic_id: 30874 reply_id: 123759[/import]

SO… once again. I am at it again. lol I got the button to go back to the previous screen. But those stupid widgets will not disappear no matter what. Where you able to get them to disappear when you hit the back button? am I labeling something wrong? what is it. [import]uid: 69302 topic_id: 30874 reply_id: 123838[/import]

Add it to the same group you’re adding your other images to if using Director or Storyboard, or if not simply remove it using display.remove() or obj:removeSelf()

If that isn’t clear enough post your code, will help :slight_smile: [import]uid: 52491 topic_id: 30874 reply_id: 123461[/import]

Its clear peach , but its not working. I have tried putting the display,remove() and obj:removeSelf() everywhere and it will not go away :(. I just want the previous screen and its button to show when user hit back.
And what was weird was that in order to get the back button to go back I had to name the gotoscene as Scene1, although I named it scene1. is that normal?

-----scene2.lua

[code]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– include Corona’s “widget” library
local widget = require “widget”


– forward declarations and other locals
local playBtn

– ‘onRelease’ event listener for playBtn
local function onButtonEvent()
storyboard.gotoScene( “Scene1”)
return true – indicates successful touch

end

–> Starts our app


– BEGINNING OF YOUR IMPLEMENTATION

– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.


local background = display.newRect(0,0,display.contentWidth,display.contentHeight)
background:setFillColor(0,0,0)

– create a widget button (which will loads scene2.lua on release)
playBtn = widget.newButton{
label=“Go Back”,
labelColor = { default={255}, over={120} },
default=“button.png”,
over=“button-over.png”,
width=100, height=40,
onEvent = onButtonEvent – event listener function

}
playBtn:setReferencePoint( display.TopLeftReferencePoint )
–group:insert( playBtn )
–display.remove(“PickerWheel”)

–end

– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view

– INSERT code here (e.g. start timers, load audio, start listeners, etc.)

end

– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view

– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)

end

– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view

if playBtn then
playBtn:removeSelf()
– widgets must be manually removed
playBtn = nil
end
end

– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view

– create a grey rectangle as the backdrop
local bg = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor( 255 )
group:insert(bg)
bg.x = display.contentWidth * 0.5;
bg.y = display.contentHeight * 0.5;

local font = native.systemFont;
end

local widget = require “widget”
widget.setTheme (“theme_ios”)
– create table to hold all column data
local columnData = {}

– create first column
columnData[1] = { “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December” }
–columnData[1] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12” }
columnData[1].alignment = “right”
columnData[1].width = 120
columnData[1].startIndex = 1

– second column (lots of rows)
columnData[2] = {}
columnData[2].alignment = “center”
for i=1,31 do
columnData[2][i] = i
end
columnData[2].startIndex = 1

– third column
columnData[3] = {}
for i=1,25 do
columnData[3][i] = i+2011
end
columnData[3].startIndex = yearIndex

local picker = widget.newPickerWheel{
id=“myPicker”,
font=“Helvetica-Bold”,
top=50,
columns=columnData
}
local widget = require “widget”
widget.setTheme (“theme_ios”)

– create table to hold all column data
local columnData = {}

– create first column
columnData[1] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12” }
columnData[1].alignment = “right”
columnData[1].width = 120
columnData[1].startIndex = 1

– second column (lots of rows)"
columnData[2] = { “00”,“01”,“02”,“03”,“04”,“05”,“06”,“07”,“08”,“09”,“10”,“11”,“12”,“13”,“14”,“15”,“16”,“17”,“18”,“19”,“20”,“21”,“22”,“23”,“24”,“25”,“26”,“27”,“28”,“29”,“30”,“31”,“32”,“33”,“34”,“35”,“36”,“37”,“38”,“39”,“40”,“41”,“42”,“43”,“44”,“45”,“46”,“47”,“48”,“49”,“50”,“51”,“52”,“53”,“54”,“55”,“56”,“57”,“58”,“59” }
columnData[2].alignment = “center”
for i= 1,59 do
– columnData[2][i] = i
end
columnData[2].startIndex = 1

– third column
columnData[3] = { “AM”, “PM” }
columnData[3].startIndex = 1

– create the actual picker widget with column data
local picker = widget.newPickerWheel{
id=“myPicker”,
font=“Helvetica-Bold”,
top=200,
columns=columnData

}
display.remove(“scene2”)

local label = display.newText(“with the understanding”, 0, 0, font, 18) ;
label:setReferencePoint(display.BottomCenterReferencePoint);
label:setTextColor(255, 255, 255) ;
label.x = display.contentWidth * 0.5;
label.y = display.contentHeight * .95;

function label:tap(e)
native.showAlert(“Tapped”,“with the understanding!”,{“Ok”})
native.showPopup(“sms”,{
–body = “I sent this text from my app”,
–to = {“5550000000”} – or “5550000000” if this doesn’t work
}) ;
end

label:addEventListener(“tap”, label);

system.vibrate()

–end

function time_to_notify(hora_in, minutos_in)
local utcTime = os.date( “!*t”, os.time() )
local timeTable = os.date("*t")
local hora_cl = timeTable.hour
local minuto_cl = timeTable.min

segundos_cl = (hora_cl*60*60)+(minuto_cl*60)
segundos_in = (hora_in*60*60)+(minutos_in*60)

if(segundos_cl>segundos_in)then
seg_reg = 86400 - segundos_cl + segundos_in
end

if(segundos_cl<segundos_in> seg_reg = segundos_in-segundos_cl
end

back = os.date( “!*t”, os.time() + seg_reg )
return back

end



– remove widget first:
display.remove( myWidget )
myWidget = nil



-----------------------------------------------------------------------------------------
– END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched whenever before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )

–scene:addEventListener( “returnScene”, scene )

-----------------------------------------------------------------------------------------

[/code]return scene [import]uid: 69302 topic_id: 30874 reply_id: 123471[/import] </segundos_in>

Uhm, line 75 try inserting background into group? If that fails can you upload zip for me to DL and run? [import]uid: 52491 topic_id: 30874 reply_id: 123491[/import]

When you did it peach pellen did it remove the widgets(picker wheels)? [import]uid: 69302 topic_id: 30874 reply_id: 123939[/import]

So I tried inserting background into group. and it removed 1 of the widgets but not the other and it caused a error:attempt to index global ‘group’ (a nil value) any other suggestions? I am trying to play with it before I cave in and send you the file :slight_smile: [import]uid: 69302 topic_id: 30874 reply_id: 123571[/import]

OK can you try moving background to around line 65, then inserting it in group right after and tell me how that goes, please? [import]uid: 52491 topic_id: 30874 reply_id: 123647[/import]

Ok Peach Pellen, I have given it all I have given that darn back button all I have and it will not function right. please help!!! lol I sent the zip file to your email or what I hope is the right email addy. Im counting on you [import]uid: 69302 topic_id: 30874 reply_id: 123715[/import]

Moving the background like I suggested above worked to remove it, the error then given was about setTextColor - this is in scene1 and is caused by the fact you have several text objects with the same name.

So 1) Give your text objects in scene1.lua unique names
2) move the background to where I mention above and insert it into the group
3) move your text in scene1.lua down to start at line 68/69 or there abouts and also insert it into the group if you don’t want it showing on the screen when you change scenes.

Fix those issues and you’ll be in better shape; still things to do but that seems to be causing the bulk of the issues. It should remove and warnings you are currently getting.

Let me know how you get on.

Peach :slight_smile: [import]uid: 52491 topic_id: 30874 reply_id: 123759[/import]

Add widgets to the display group and they will remove :slight_smile: [import]uid: 52491 topic_id: 30874 reply_id: 124254[/import]

Hello Peach,
Can you riddle me this, so I played around and got the back button to go back but now it will not go forward. But the riddle is, in order to get the widget to disappear when the user hit the back button, I change the case sensitive on my scene.lua’s but of course it does not work on the iphone itself because of the case sensitive (learned that today). :slight_smile: [import]uid: 69302 topic_id: 30874 reply_id: 124257[/import]

SO… once again. I am at it again. lol I got the button to go back to the previous screen. But those stupid widgets will not disappear no matter what. Where you able to get them to disappear when you hit the back button? am I labeling something wrong? what is it. [import]uid: 69302 topic_id: 30874 reply_id: 123838[/import]