Software Developer's Kit - ChemDraw

Send comments on this topic
index Property
See Also 


Member of ChemDraw Control.Caption.

Sets and returns the relative back-to-front ordering of this caption.

Property type

Read-write property


Visual Basic
Public Property index() As Long

Return Type



Index is set by the program, but can be set by the user, if needed. As you go drawing objects, the numbers for index are assigned consecutively, and the new object appears drawn over the previous one. If you want to change the order in which the objects appear drawn (i.e. fore & background), the index can be changed by the user. The object with the higher index will appear in front of the object with the lower index. This index starts with 1.



'Declares variables
'Object can be any ChemDraw object
 Dim ObjectA As ChemDrawControl10Ctl.Object 'e.g. BondA
 Dim ObjectB As ChemDrawControl10Ctl.Object 'e.g. BondB

'Checks that there is an object loaded in the variable
 If  Selection.Objects.Count < 1 Then
     Exit Sub
 End If
 Private Sub cmdIndex_Click() 
    'Loads the variables
     Set ObjectA = ChemDrawControl10Ctl.Objects.Item(1) 
     Set ObjectB = ChemDrawControl10Ctl.Objects.Item(2) 
    'ObjectA was drawn first, ObjectB was drawn crossing over ObjectA
     Text1.text = ObjectA.index  'e.g. 10 
     Text2.text = ObjectB.index  'e.g. 12 
    'Back to front ordering changed by user: 
     ObjectA.index = 16  'This will make ObjectA appear drawn over ObjectB
 End Sub

See Also

Caption Object