OnClose event

Started by johnM, January 24, 2008, 01:44:31 PM

Previous topic - Next topic

johnM

I have a dockable form with a tree control on it and I want to save the tree info to a file when the dialog box is closed. I have tried the OnClose event but the form name “qdiso_ISO_1_TreeControl1” becomes nil and
(dcl_Tree_GetRootItem qdiso_ISO_1_TreeControl1) returns an error
any suggestions?

BazzaCAD

I would add a "Close" or "OK" button then in the OnClicked event for that button grab all the info from the tree, write to your file, then close the form.
Is that what you're trying to do?
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

It looks like OnClose fires too late in the process when AutoCAD is closing. I'll investigate to see if this can be fixed. As a workaround, you can try to use OnEnteringNoDocState to do your cleanup.
Owen Wengerd (Outside The Box) / ManuSoft

johnM

I don’t really want to put a close button on the form because it is inevitable that someone will close it by the “X” at the top of the form. (but never say never)

When does the OnEnteringNoDocState fire?
I put in the code, made sure the dialog box was updated and it will not fire
I’m running studio version 4.2.1.0
In the intelligence help it states:
Event EnteringNoDocState

The description for this Method, Property or Event has not been set in the ActiveX control.

AutoLISP Syntax:
c:qdiso_ISO_1_OnEnteringNoDocState ()

thanks

johnM

Sorry, I figured out the OnEnterNoDocState. It works when the drawing is closed, I’m sure I’ll find a use for it but it dose not solve my dilemma. But thanks for suggesting it.
The problem is if a person wants to keep the drawing open but close the dialog box, how do I save the tree info.

owenwengerd

Quote from: johnM on January 24, 2008, 08:41:56 PM
The problem is if a person wants to keep the drawing open but close the dialog box, how do I save the tree info.

I assumed OnClose would work in that case.  If not, I'll have to investigate.
Owen Wengerd (Outside The Box) / ManuSoft

johnM

I figured out how to solve the issue. First the project.vlx has to be in the AutoCAD start up suite so it loads automatically.
I use the AutoCAD reactor vlr-docmanager-reactor with :vlr-documentToBeDeactivated and save the existing tree data before it closes.
I use the DocOnDocActivated to read the data to populate the tree for the new drawing.

owenwengerd

Quote from: johnM on January 25, 2008, 09:29:03 AM
I figured out how to solve the issue.

I'm glad you found a workaround. I've fixed the OnClose event for the OpenDCL 5 Alpha 2 so that it always fires synchronously. This means you can't use the (command) function in your handler, but your handler will execute before the form is destroyed.
Owen Wengerd (Outside The Box) / ManuSoft

JMack

Owen, that's a great fix! I've been dealing with that issue since version 1.0.  I didn't even think it was a bug or a feature that could be implimented.

Thanks,
JMack