Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

How to detect that a DzDialog is about to Close?

$
0
0

Hi All,

I've been reading this forum for a few years, but this is my first post - so I'll start by saying a big Thank You to all those who have been so generous with their time and knowledge, in particular to:

Now to my question:

I have a DzDialog with a "Close" DzPushbutton that calls a saveDataAndCleanUp() function and then calls the DzDialog.close().  That all works fine:

wDialog = new DzDialog;

wCloseButton = new DzPushbutton( wDialog );
wCloseButton.text = "Close";
connect( wCloseButton, "clicked()", doClose );

function doClose()
{
  saveDataAndCleanUp();
  wDialog.close();
};

function saveDataAndCleanUp()
{
  // Save changed data, etc...
};

But my problem is that if the User closes the dialog by clicking the X button in the dialog's title bar, then my script gets no chance to execute the saveDataAndCleanUp() code.

The wDialog[] array of Members shows a "destroyed()" member, but it does not work for me (maybe because the dialog has closed but not actually been destroyed?):

connect( wDialog, "destroyed()", saveDataAndCleanUp );

In DAZStudio4 SDK/docs/qt/qdialog.html#finished there appears to be the potential for the desired signal, but this does not work either (but does not cause an error):

connect( wDialog, "finished()", saveDataAndCleanUp );

So:

Q1) Is there a way to ensure that saveDataAndCleanUp() gets called no matter how the dialog gets closed?

Q2) If not, then is there a way to disable or hide the X button in the dialog's title bar?

TIA.


Viewing all articles
Browse latest Browse all 1036


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>