Software Developer's Kit - ChemDraw

Send comments on this topic
AltGroups Property
See Also 

Description

Member of ChemDraw Control.AltGroup.

Returns the AltGroups in this AltGroup.

Property type

Read-only property

Syntax

Visual Basic
Public Property AltGroups() As AltGroups

Return Type

Remarks

This property refers to the collection of AltGroups within this AltGroup. The AltGroups contained in a specific alternative group box are referenced through the AltGroups Item member. The members of this collection will be the AltGroups in this AltGroup.

The properties associated with the collection are the following:

myAltGroup.AltGroups.Application      returns the application associated with the collection of AltGroups
myAltGroup.AltGroups.Count             returns the number of AltGroups that are in this AltGroup
myAltGroup.AltGroups.Item(i)            returns one AltGroup from the collection of AltGroups
myAltGroup.AltGRoups.Parent            returns the parent of the collection of AltGroups

With AltGroup.AltGroups.Item(i) all the AltGroup properties are enabled for AltGroup(i). This index starts with 1.

Example

'This example reads data from an alternative group
 Private Sub cmdShowAtoms_Click()
    Dim vAltGroup as ChemDrawControl10Ctl.AltGroup
    Set vAltGroup = ChemDrawControl10Ctl.AltGroups.Item(1)
    For I = 1 To vAltGroup.Atoms.Count
        If  vAltGroup.Atoms.Item(I).IsAttachmentPoint = False Then
            List1.AddItem (vAltGroup.Atoms.Item(I).LabelText)
        Else
            List1.AddItem ("Number:º " & I & " is an attachment point")
        End If
     Next I
 End Sub

'Shows number of AltGroups within one AltGroup versus AltGroups in the ChemDraw document  
 Private Sub cmdShowNumberOfAltGroups_Click() 
     Dim myAltGroup1 as ChemDrawControl10Ctl.AltGroup
     Dim myAltGroup2 as ChemDrawControl10Ctl.AltGroup 
    'Checks if at least two AltGroups have been drawn
     If  ChemDrawControl10Ctl.Objects.AltGroups.Count >= 2 Then 
         Set MyAltGroup1 = ChemDrawControl10Ctl.Objects.AltGroups.Item(1)
         Set MyAltGroup2 = ChemDrawControl10Ctl.Objects.AltGroups.Item(2)
        'Returns the number of atoms in each AltGroup
         vMessage = MsgBox("AltGroup1 has: " & MyAltGroup1.Atoms.Count & " Atom/s" _
                    & "AltGroup2 has: " & MyAltGroup2.Atoms.Count& " Atom/s", _
                    vbInformation + vbOKOnly, "Info") 
        'Returns the number of AltGroups within AltGroup1
         Text1.text = "AltGroup1 has: " & format(MyAltGroup1.AltGroups.Count, "##") & " AltGroup/s" 
        'Returns the number of AltGroups within the ChemDraw document
         Text2.text = "There are: " & format(ChemDrawControl10Ctl.Objects.AltGroups.Count, "##") & " AltGroup/s" 
     End If
 End Sub

See Also