Name: shutdownRequest

Type: message

Syntax: shutdownRequest

Summary: Sent to the <current card of the defaultStack (glossary)>when the user tries to quit the <application>.

Associations: stack

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
on shutdownRequest
  answer question "Are you sure you want to quit?" with "Yes" or "No"
  if it is "Yes" then pass shutdownRequest 
end shutdownRequest

Description:
Handle the <shutdownRequest> <message> if you want to prevent the user from quitting the <application>.

If the <shutdownRequest> <handler> does not <pass> the <message> or send it to a further <object> in the <message path>, the <application> does not exit. <pass|Passing> the <message> allows the <application> to quit.

In standalones, some care is needed to ensure you receive the <shutdownRequest> message if your application uses multiple stacks. The most reliable approach is to install a library stack or backscript to handle the message when your application starts up.

On OS X and Unix systems, if the operating system sends a SIGTERM signal to the application, LiveCode sends a <shutdownRequest> <message> to the <current stack>. <pass|Passing> the <message> causes the application to quit normally. If the <message> is <trap|trapped>, the signal is ignored. 
 
>*Note:* Applications will not receive this message when running in the IDE.
 
Changes:
Handling of the SIGTERM signal was introduced in version 2.0. In previous versions, the SIGTERM signal did not cause a message to be sent.

References: quit (command), pass (control_st), application (glossary), current card of the defaultStack (glossary), current stack (glossary), handler (glossary), message path (glossary), pass (glossary), message (glossary), trap (glossary), object (object)

Tags: windowing
