Prev Next

EA_OnPreNewElement

EA_OnPreNewElement notifies Add-Ins that a new element is about to be created on a diagram. It enables Add-Ins to permit or deny creation of the new element.

This event occurs when a user drags a new element from the Toolbox or 'Resources' tab of the Browser window onto a diagram. The notification is provided immediately before the element is created, so that the Add-In can disable addition of the element.

Syntax

Function EA_OnPreNewElement (Repository As EA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewElement function syntax contains these parameters.

Parameter

Type

See also

Repository

EA.Repository

Direction: IN

Description: An EA.Repository object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information.

Repository Class

Info

EA.EventProperties

Direction: IN

Description: Contains these EventProperty objects for the element to be created:

  • Type: A string value corresponding to Element.Type
  • FQStereotype: A string value corresponding to Element.FQStereotype
  • Stereotype: A string value corresponding to Element.Stereotype
  • ParentID: A long value corresponding to Element.ParentID
  • DiagramID: A long value corresponding to the ID of the diagram to which the element is being added
EventProperties Class

Return Value

  • Return True to enable addition of the new element to the model
  • Return False to disable addition of the new element

Learn more