Page 1 of 1

One question about quitting an application...i need help

Posted: Mon Jun 11, 2007 6:21 pm
by LESTROSO
Dear expert users,

i have a problem by quitting an application.......... :cry:


i want to quit by a simple script like this.......:

on CLOSESTACK

answer "Are you sure you want to quit?" with "No" or "YES"

switch it

case "YES"

hide this stack
quit

exit switch

case "NO"

exit closestack
exit switch

end switch

end CLOSESTACK

But if you push "Yes" the app quit perfect ok!!!,If you push "No" the app quit too...why?????

I want that if you push "No" the app don't quit and remain in the same card......

thanks a lot for your help and ideas......

Lestroso
:D

Posted: Mon Jun 11, 2007 8:37 pm
by xApple
Check the "switch" syntax: it's "break" not "exit switch"
But your problem is that aborting the closeStack messages doesn't stop the quitting process.
You are looking for the "shutdownRequest" message rather.

Code: Select all

on shutdownRequest -- confirm with the user:
  answer question "Are you sure you want to quit?" with "Yes" or "No"
  if it is "Yes" then pass shutdownRequest -- allow to quit
end shutdownRequest

Posted: Tue Jun 12, 2007 8:36 pm
by LESTROSO
Thanks xapple!!!!


But the problem still remain....... :cry:


I have right the code like this.....:




on closeStack

answer "Are you sure you want to quit?" with "No" or "YES"
switch it
case "YES"
hide this stack
quit
BREAK
case "NO"

BREAK

end switch
end closeStack

But the stack quit always....i don't know....i've tryed your code for the showtdown...but don't work... iwant that the code work when i push the close window button.......

ok....

if you have any other ideas......o perhaphs i have made another mistake to write the code.......

thanks


lestroso
:D

Posted: Tue Jun 12, 2007 9:09 pm
by xApple
As I said previously, trapping the closeStack Message doesn't change anything. And even if it did, it wouldn't work in the case of your script, since you don't pass it on in the "No" case. By the way, it's useless to have a case in a switch structure with no statements. Speaking of scripts, could you please enclose your scripts in "

Code: Select all

" tags ? It's the little button at the top of the field used to write your post.

If you want a user confirmation when using the close window button and not only when the application quits, use the closeStackRequest message.

[code]
on closeStackRequest
 answer "Are you sure?" with "No" or "Yes"
 if it is "Yes" then pass closeStackRequest 
end closeStackRequest

Posted: Wed Jun 13, 2007 6:23 pm
by LESTROSO

Code: Select all

 Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!! Thank you x-apple!!!!!
Thank you very much!!! this script work so fine!!!It's the best for my application.....

i'm so sorry for the script without the code...[...code]-[.../code], because i didn't remember me this trick......

thanks again.......

see you soon on the forum....

lestroso

bye.... :wink: :wink: :D