Click Events

Manifold scripts may be written for processing of mouse clicks and double clicks done in drawing, image, labels, map, profile, surface, or theme windows. Click events are routed to a script or form named OnClick. Double click events are routed to a script or form named OnDoubleClick. The parameters of both events are delivered through the global EventArgs object.


The Process global events with scripts option in Tools - Options - Miscellaneous allows (the default) or disallows the processing of click and double click events with scripts.


If desired, the OnDoubleClick event handler can cancel further processing of a clicked object (which might otherwise go to an URL or result in the display of the Object Fields dialog) by setting the Handled property of the EventArgs object to True.




Create a VBScript script named OnClick and enter the following script:


Sub Main

If EventArgs.HasObject Then

Application.MessageBox EventArgs.Object.ID, "Clicked Object"

End If

End Sub


Create a new drawing and populate it with some objects. Click an object. The system will display a message box reporting the object's ID.


See Also


EventArgs Object

Tools - Options