Software Developer's Kit - ChemDraw

Send comments on this topic
Groups Collection
See Also  Members 

Description

Member of ChemDrawControl.

For a list of all members defined for this collection, see Groups Members.

ChemDraw Groups Collection contains all of the group objects in the document.

Object Model

Remarks

Groups is a collection containing all of the group objects in the ChemDraw document. If MyGroups is a group collection object, then:

MyGroups.Application    returns the application associated with the collection of groups
MyGroups.Count           returns the number of groups in the collection of groups
MyGroups.Parent          returns the parent of the collection of groups
MyGroups.Item(1)        given an index, references one group in particular from the collection of groups

With MyGroups.Item(i) all the group properties are enabled for group(i) of the groups collection.  This index starts with 1.

Example

'Number of Groups 
 Dim MyGroup  As ChemDrawControl10Ctl.Group 
 Dim MyGroups As ChemDrawControl10Ctl.Groups 
 Set myGroups = ctlChemDraw.Selection.Objects.Groups

 Private Sub ctlChemDraw_SelectionChanged(ByVal selection As ChemDrawControl10Ctl.IChemDrawSelection)
     If  ctlChemDraw.Objects.Groups.Count = 1 Then 'Checks if one group has been drawn
         Set MyGroup = ctlChemDraw.Objects.Groups.Item(1)
         Command1.Enabled = True 'enables whatever has to be done if one group is selected
     Else
         Command1.Enabled = False 'opposite action 
     End If 
 End Sub

 Private Sub cmdGroups_Click()
     vMessage = MsgBox("Number of groups in the document: " & MyGroups.Count, vbInformation + vbOKOnly, "Info")
 End Sub


See Also