Software Developer's Kit - ChemDraw

Send comments on this topic
ObjectTag Object
See Also  Members 

Description

Member of ChemDraw Control.

For a list of all members defined for this object, see ObjectTag Members.

ChemDraw ObjectTag represents an ObjectTag object. 

Object Model









Remarks

An ObjectTag allows the user to attach an arbitrary piece of information to any ChemDraw object. This information can later be retrieved. 

An ObjectTag consists of a name and data of a certain data type. The name is an arbitrary string of characters. To avoid accidental conflicts, we recommend that you prefix all ObjectTag names with your company and the name of the application.  (ChemDraw, for instance, uses ObjectTags internally for some purposes. All ChemDraw ObjectTags begin with /CS/CD/).

The value of an ObjectTag can be a string of characters, a floating point number, or an integer number.  Those values are set or retrieved by the StringValue, DoubleValue and LongValue properties. 

The name of the ObjectTag doesn´t need to be unique, see MakeObjectTag.

An ObjectTag also has the Persistent property. By default, an ObjectTag is not persistent and is not saved into a CDX file. If you want the ObjectTag to be saved, set the Persistent property to False.

Example

'Example - ObjectTag 
'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 of Object Tag"
     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
     End If
 End Sub

See Also