Event Invoke

Friendly Name Event Invoke
API Name EventInvoke
Type Integer
Restrictions Range is 0 - 1
Get Function   (dcl-Control-GetEventInvoke <CONTROL>)
Set Function   (dcl-Control-SetEventInvoke <CONTROL> NewValue [as Integer])
Applies To All Controls and Forms

This property controls whether event handlers are called synchronously or asynchronously. A synchronous call causes the dialog code to wait until the event handler returns before resuming; an asynchronous event call allows the dialog code to continue running, and the event handler is not executed until AutoCAD is ready to process commands. This property is hidden and ignored for controls on modal forms.

Value Meaning
0 Synchronous
1 Asynchronous

Event handlers that are called synchronously are limited in what they can safely do, because they run while the dialog code is in a suspended state and AutoCAD is unable to process commands. For example, it is not possible to call the AutoLISP (command) function from a synchronous event handler.

Asynchronous event handlers in most cases will not execute until after the event that triggered it has passed, however an asynchronous event handler can safely call the AutoLISP (command) function to process AutoCAD commands. When a modeless dialog control's event handlers need to use the AutoLISP (command) function, the Event Invoke property for the control must be set to 1.

Any events that have return values are always called synchronously (otherwise the return value would be lost). Events called from modal forms are always called synchronously, since modal forms by their nature prevent AutoCAD from executing commands while they are active. Event handlers in these cases must conform to the requirements for synchronous events regardless of the Event Invoke property setting.