Page 1 of 1

stop close stack

Posted: Thu May 24, 2012 8:36 am
by link76
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

Re: stop close stack

Posted: Thu May 24, 2012 9:17 am
by jmburnod
hi Link76,

Check "closeStackRequest" in the LC dictionary

Just an idea, no tested

Best regards

Jean-Marc

Re: stop close stack

Posted: Thu May 24, 2012 9:26 am
by Klaus
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

Re: stop close stack

Posted: Thu May 24, 2012 10:13 am
by link76
it wors! thank Jean-Marc & thank you Klaus!!