Using The "x" Button To Close Windows

I built myself a custom GUI with it's own Close Button that stores window options to an optionVar.

However, if someone uses the default "X" button that comes with the window, obviously my shutdown instructions won't get called.

However can I execute the same function whether they use the Close button I provide them or the standard Window's Close Window button?

thanks.

you can set up a scriptJob thats attached to your UI and acts on uiDeleted.

Aslo if you make the window a scripted panel it will have a function for you to record the settings. Among other benefits such as hotkey propagation, ability to dock it in the gui, side panel etc.

can you do a "how to make a scripted panel"-tutorial thing? ;]

Only if you agree to be my editor for the tuorial

sure thing!

but ... err what does that mean?!? ;]

QUOTE(ewerybody @ 01/21/09, 01:54 PM) [snapback]299329[/snapback]
but ... err what does that mean?!? ;]

The job of a editor is to check that the language is correct understandable and sometimes verifiable I'm not exactly taht picky but thing is i want a layer between my ramblings... I mean its hard to ge things right on the spot.

no problem I can do that.

thanks for the tip on scriptJobs, that will help me out.

scripted panels do sound cool, i'll try it out when i get more time!

I ran into a snag using a scriptJob that triggers on deleteUI... it appears that the script called by a scriptJob fires AFTER the UI is deleted, which doesn't solve my problem...

the script I want to run when the window closes queries the value of certain elements and stored them to an optionVar...

the problem is, if I use a scriptJob that triggers on deleteUI, the UI is deleted first, then the script is run and can't find the values I wish to store...

Make a scripted panel type, this will by the way take some time as i currently have no maya for atleast a week.