Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
LESTROSO
- Posts: 85
- Joined: Wed Apr 04, 2007 6:14 pm
-
Contact:
Post
by LESTROSO » Mon Jun 11, 2007 6:21 pm
Dear expert users,
i have a problem by quitting an application..........
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

-
xApple
- Posts: 113
- Joined: Wed Nov 29, 2006 10:21 pm
Post
by xApple » Mon Jun 11, 2007 8:37 pm
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
-
LESTROSO
- Posts: 85
- Joined: Wed Apr 04, 2007 6:14 pm
-
Contact:
Post
by LESTROSO » Tue Jun 12, 2007 8:36 pm
Thanks xapple!!!!
But the problem still remain.......
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

-
xApple
- Posts: 113
- Joined: Wed Nov 29, 2006 10:21 pm
Post
by xApple » Tue Jun 12, 2007 9:09 pm
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
-
LESTROSO
- Posts: 85
- Joined: Wed Apr 04, 2007 6:14 pm
-
Contact:
Post
by LESTROSO » Wed Jun 13, 2007 6:23 pm
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....
