I have a datawindow and I am toggling between visible and invisible depending on some logic. I have now added the control menu to the datawindow, so that the user can click at the right top corner to close the datawindow itself. How can I sense when the user is closing the datawindow. Coding in the Destructor event of the datawindow did not help.