Chapter 9 Accessing objects using VBScript


Attaching a link object to symbols

After you create the link object, you have to declare its ends, then you attach it to the diagram by adding the following parameters: the object to display and the ends to attach. You use the following method: AttachLinkObject(ByVal Link As BaseObject, ByVal Sym1 As BaseObject = NULL, ByVal Sym2 As BaseObject = NULL) As BaseObject.

Example with a relationship linking two entities

  'create entities objects
set entity1 = ActiveModel.entities.createnew
set entity2 = ActiveModel.entities.createnew
  'display entities symbols
set symbol1 = ActiveDiagram.AttachObject(entity1)
set symbol2 = ActiveDiagram.AttachObject(entity2)
  'create relationship object
set r = ActiveModel.relationships.createnew
  'Declare both ends
 r.object1= entity1
 r.object2= entity2
   'display relationship symbol between the two entity symbols: r=object to display, symbol1 and symbol2 are the ends to attach
 set Rsymb=ActiveDiagram.AttachLinkObject(r,symbol1,symbol2)

In this example, if parameters symbol1 and symbol2 are omitted in the AttachLinkObject method, their symbols are nevertheless created in the diagram (or a graphical synonym, if needed)

 


Copyright (C) 2005. Sybase Inc. All rights reserved.