Home | Contents | Index | Help | < Browse | Browse >
The OnExit Command
This is a new command in selector 5.0. It specifies what
will happend just before the program ends.
OnExit
[ EXEC <command> | RUN <command> | ScreenRun <screen> <cmd>
| UPDATE | LOADUPDATE | LOAD <file> [arguments]
| EXIT [<string>] | QUIT [<string>]
| DumpX <variable> | DumpY <variable>
| LastX <variable> | LastY <variable>
| LastXPos <variable> | LastYPos <variable>
| Popup | PopupClose
| Setenv <variable> <value> | UnSetenv <variable> ]
( ['command 1' 'command 2' ... 'command n'] )
There can be only one OnExit command in a script.
The command is executed when the window is closed, using the standard
close-gadget, when pressing ESC or when an EXIT command is reached from
a Button/OnChange command. But if the QUIT command is used instead of
the EXIT command, the OnExit command won't get executed before
quitting.
Use this command with care! It's possible to make a window you can't
get rid of, for example:
onExit update
text "Can't get rid of me!"
Better example of OnExit usage:
defenv xvar auto
defenv yvar auto
x [xvar]
y [yvar]
onexit dumpx xvar dumpy yvar
text "Move this window around and"
text "then close it! Open it again!"
text "Where will it appear next?"
Try it!
Home | Contents | Index | Help | < Browse | Browse >