1 Reply Latest reply on Apr 19, 2018 7:09 AM by Taus Moller

    How to handle document's close button click event?

    Tayfun Çetin

      We are trying to handle document close event. When document closed if has some change Save as Dialog raised.

      When try to close document by click on close button of document, Destroy event has raised (We have some functions by raising destroy event).

      Before of rasing Destroy event Save as Dialog raise and ask about save document. We want to skip Saved as Dialog form.

      For this added SWApplication.CloseAllDocuments(true) to the project but Save Dialog raised again.


      I think we put SWApplication.CloseAllDocuments(true) in wrong place.

      Would any body help us please, where should i put "Close All Documents" to close Save Dialog, before raising of Destroy event?

        • Re: How to handle document's close button click event?
          Taus Moller

          The argument to CloseAllDocuments apparently only concerns whether or not to close dirty documents. Not whether or not they should be saved. If you want to Close a document and discard changes you can use QuitDoc. but you will have to iterate through all open documents manually.


          Maybe something like


          ModelDoc2 doc;
          while((doc = SWApplication.ActiveDoc) != null)


          This is just off the top of my head, at have not been tested , but i think the general principle should work