event SelectGroup (Group as Group)
Occurs when a group is clicked.

 TypeDescription 
   Group as Group A Group object being selected.  
Use the SelectGroup event to notify your application that a new group is selected ( clicked ).

The following sample focuses the group's list window when user selects the group:

Private Sub ExplorerTree1_SelectGroup(ByVal Group As EXPLORERTREELibCtl.IGroup)
    Group.SetFocus
End Sub

The following sample highlights the group being clicked, and restores the last selected group:

Dim gSelected As EXPLORERTREELibCtl.Group

Private Sub highGroup(ByVal g As EXPLORERTREELibCtl.Group)
    g.UserData = g.BackColor2
    g.BackColor2 = vbBlue
End Sub

Private Sub unHighGroup(ByVal g As EXPLORERTREELibCtl.Group)
    g.BackColor2 = g.UserData
End Sub

Private Sub ExplorerTree1_SelectGroup(ByVal Group As EXPLORERTREELibCtl.IGroup)
    If Not gSelected.Index = Group.Index Then
        gSelected.Expanded = False
        unHighGroup gSelected
        Set gSelected = Group
        highGroup gSelected
    End If
End Sub

Private Sub Form_Load()
    Dim g As EXPLORERTREELibCtl.Group
    ExplorerTree1.DelayScroll = 0
    ExplorerTree1.BeginUpdate
    For Each g In ExplorerTree1.Groups
        g.Expanded = False
        g.BackColor = ExplorerTree1.BackColorGroup
        g.BackColor2 = ExplorerTree1.BackColorGroup2
    Next
    Set gSelected = ExplorerTree1.Groups(0)
    gSelected.Expanded = True
    highGroup gSelected
    ExplorerTree1.EndUpdate
End Sub


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.