Application restarts after quiting
Posted: Sun Jan 12, 2014 6:27 pm
I've created a small app that is based on the RunRev slideshow example that uses images imported onto card backgrounds as controls. My problem is that when the application is closed (using the window 'X' icon) while an image transition is actually in progress the application closes and immediately reopens. I've spent all afternoon playing with the code to no avail. Why is this happening and how do I successfully exit the app at all times?
I also have another issue which only occurs when the application window is resized using the 'maximize' button during an image transition. The image below shows what happens:
Code: Select all
local sMessageID ## stores the message ID so we can stop the background changing
on openCard
## executed every time we go to a new card
## the slideshow begins when openCard is executed
## delay 2 seconds, then go to the next card
send "showNextSlide" to me in 2 seconds
## store the ID of the delayed message you just sent, so
## you can cancel it if the user clicks pause
put the result into sMessageID
end openCard
on closeStack
quitMyProject
end closeStack
on mouseUp
## when the user clicks
if "showNextSlide" is among the items of the pendingMessages then
## stop the slideshow
cancel sMessageID
else
## restart the slideshow
showNextSlide
end if
end mouseUp
on showNextSlide
visual effect "dissolve fast"
go next card
## which will trigger the openCard handler
end showNextSlide
command quitMyProject
cancel sMessageID
lock messages
-- stop using stacks
put the stacksInUse into myStacks
repeat for each line myStack in myStacks
stop using stack myStack
end repeat
-- stacks
put the openStacks into myStacks
put "message box,home,tool,Message Box,revTools,revMenubar" & comma & the short name of me into myDontClose
repeat for each line myStack in myStacks
if myStack is not among the items of myDontClose then close stack myStack
end repeat
-- messages
put the pendingmessages into myMsgs
repeat for each line myMsg in myMsgs
cancel item 1 of myMsg
end repeat
close me
if the environment is not "development" then
quit
end if
end quitMyProject