CreateObject Event (Application Object)

Scope: Schematic editor

Object: Application Object

Prerequisites: None

Occurs whenever a new object is created. Use this event to stipulate other events, such as verifying that a component is labeled, has correct attributes, and so on.

Usage

Sub Application_CreateObject(ByVal ReasonFlag As VdCreateTime, ByVal ObjectType As VdObjectType, ByVal Block As IVdBlock, ByVal Object As Object)

Arguments

ReasonFlag

Specifies that the event occurs either before or after the object is placed. This argument takes the form of VdCreateTime Enum.

ObjectType

Specifies the type of object being created in the form of VdObjectType Enum.

Block

The block in which the object is being created.

Object

The dispatch interface of the object that was just created. You must cast it to the correct type by using the ObjectType parameter.

Examples

Add a label when new components are created.

Sub Application_CreateObject(ByVal ReasonFlag,  ByVal ObjectType,  ByVal Block,  ByVal Object) 
If ObjectType = VDTS_COMPONENT Then 
Object.AddLabel "LABEL", Object.GetLocation().X, Object.GetLocation().Y 
    End If 
End Sub