Software Developer's Kit - ChemDraw

Send comments on this topic
GetObjectTag Method
See Also 
name

Name is the name of the ObjectTag you wish to get.

Description

Member of ChemDraw Control.ObjectTag.

Returns the ObjectTag of this ObjectTag.

Syntax

Visual Basic
Public Function GetObjectTag( _
   ByVal name As String _
) As ObjectTag

Parameters

name

Name is the name of the ObjectTag you wish to get.

Return Type

Remarks

Object tags are arbitrarily named properties which can be attached to any ChemDraw object.  This object can be used to associate arbitrary data with an object. 

Object tag names are critical to their management, since the name tells ChemDraw how to interpret the tag.  All tags assigned internally by ChemDraw begin with the character sequence "/CS/CD/".  Tags created for user purposes should begin with some other character sequence.  Any ChemDraw object can have any number of tags attached to it, including multiple tags with the same name.


Retrieves a previously created ObjectTag for this object. Once the ObjectTag is retrieved, you can work on its properties; read them, or assign values to those that are read/write.

Example

'Declaration of variables - object can be any ChemDraw object
 Dim vObjectTag As ChemDrawControl10Ctl.ObjectTag
 Dim myObject As ChemDrawControl10Ctl.Object
 Dim vName As String
'------------------------------------------------------------
 Private Sub cmdMake_Click()
     vName = "NewName"
     Dim vAux As String
     vAux = "Value in ObjectTag"
     Set vObjectTag = Nothing
    'creates the object tag
     MyObject.MakeObjectTag vName, vObjectTag, True
     vObjectTag.StringValue = vAux
     If  (Not vObjectTag Is Nothing) Then
         'gets the object tag but it must be visible to see
         MyObject.GetObjectTag vName
         vObjectTag.Visible = True
         Text1.Text = vObjectTag.StringValue 
         'Values can be assigned to the referenced ObjectTag  
         MyObject.GetObjectTag(vName).Color = VBRed
         MyObject.GetObjectTag(vName).Caption.Angle = 45
     End If
 End Sub

See Also