Asynchronous Code Running?

Started by Martin, September 24, 2016, 07:54:49 PM

Previous topic - Next topic

Martin

I have been asked to check for code for problems for a company that is migrating to AutoCAD Mechanical 2016.
They have been using ODCL successfully for sometime in AutoCAD Mechanical 2014.
It appears to me that after clicking a button and the _OnClicked event is run the dialog is returned before the code execution is completed.

Is this a problem that can be overcome with settings in AutoCAD or within the ODCL?

I have spent a lot of time trying to research this problem and also confirm what the problem is
Any help will be gratefully received.

owenwengerd

This usually indicates improper code running in a handler that is unsafe to execute while a modal form is still active. You need to move that code out of the event handler and into the main function (the one that calls (dcl-Form-Show) so that it executes after the dialog has closed. There are other posts here in the forum about the same problem, along with sample code showing the correct way to structure the code.