event StateChange (NewState as StatesEnum)
Fired when the list's state has been changed: focus, selection.

 TypeDescription 
   NewState as StatesEnum A StatesEnum expression that represents the current state.  

This event is fired each time current state is changed. It is fired on these events:

1. When eXShellView control got the focus,
2. When eXShellView lost the focus,
3. When current selection was changed,
4. When item was renamed.

Depending on newState variable, user can make certain actions. Use the Objects property to retrieve the collection of selected items.

The following sample gets a collection of selected items ( in case your control allows multiple selection ):

Private Sub ExShellView1_StateChange(ByVal newState As EXSHELLVIEWLibCtl.StatesEnum)
    If (newState = SelChangeState) Then
        ExShellView1.Objects.Get SelectedItems
        With ExShellView1.Objects
            For i = 0 To .Count - 1
                Debug.Print .Item(i).Name
            Next
        End With
    End If
End Sub

In case your control supports single selection, you can use the ObjectSelected event to notify when a new item/object is selected:

Private Sub ExShellView1_ObjectSelected(ByVal Object As EXSHELLVIEWLibCtl.IExShellObject)
    If Not (Object Is Nothing) Then
        Debug.Print Object.Name
    End If
End Sub

 


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