shutdownRequest

Typemessage
DictionaryLCS
LibraryLiveCode Script
Syntax
shutdownRequest
Associationscard
Summary

Sent to the current card of the defaultStack when the user tries to quit the application.

Introduced1.0
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.

OSmac, windows, linux, ios, android
Platformsdesktop, server, 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
RelatedProperty: defaultStack
Command: quit
Glossary: application, current card, current stack, handler, message path, pass, message, trap, object
Control Structure: pass
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. 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. Passing the message causes the application to quit normally. If the message is trapped, the signal is ignored.

Note: Applications will not receive this message when running in the IDE.

Tagswindowing