stop close stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

stop close stack

Post by link76 » Thu May 24, 2012 8:36 am

Hi,
how can I control the closure of the substack when the user clicks on the window button close?

Code: Select all

on CloseStack
 answer info "Close ?" with "Yes" or "No"
    switch it 
            case "Yes"
            .... close stack
            case "No"
            exit CloseStack
end CloseStack
but the window is always closed

thanks

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: stop close stack

Post by jmburnod » Thu May 24, 2012 9:17 am

hi Link76,

Check "closeStackRequest" in the LC dictionary

Just an idea, no tested

Best regards

Jean-Marc
https://alternatic.ch

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: stop close stack

Post by Klaus » Thu May 24, 2012 9:26 am

Hi Link76,

yep, Jean-Marc is right, you cannot stop a "closestack" handler, use "closestackrequest" instead!
PASS it to let the stack close:

Code: Select all

on CloseStackRequest
   answer info "Is there any beer left?" with "Yes" or "No"
   if it = "Yes" then
        ## close stack:
       PASS closestackrequest
   end if
   ## no other action neccessary
end CloseStackRequest
Just to be sure, your switch syntax was incorrect:

Code: Select all

...
switch tValue
  case "this"
    ## do whatever
  break
  case "that"
    ## do another thing
  break
end switch
...
If you leave out the "break" and/or "end switch" you will be surprised heavily 8)


Best

Klaus

link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

Re: stop close stack

Post by link76 » Thu May 24, 2012 10:13 am

it wors! thank Jean-Marc & thank you Klaus!!

Post Reply