Livecode Wiki

Sent to the current card when the user tries to close a stack. If there is a message handler by the same name in the message path, then it will be executed.




The closeStackRequest message is only sent if the request to close a stack is initiated by the user (eg by clicking file -> close in the LiveCode menu). If the request is initiated from a script (eg "close this stack" ) then the closeStackRequest message is not sent.

Message handler[]


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

Use the closeStackRequest Message handler to prevent a stack from being closed.

You have to pass the closeStackRequest. If the closeStackRequest handler does not pass the message or send it to a further object in the message path, the stack does not close. Passing the message allows the stack to close.

See also: closeStack, stack & decorations.