HeaderPane
Main
Hide
Share Link
Print

ItemClick Event, SftTree Class

Occurs when an item, cell or part is clicked.

Class: SftTree
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public event ItemClickEventHandler ItemClick;
Public Event ItemClick As ItemClickEventHandler

Comments

Occurs when an item, cell or part is clicked.

Please note that the ItemClick event reflects mouse button events. The SelectionChanged event should be used when selection changes need to be tracked, as these can also occur through keyboard input, which is not reflected by the ItemClick event.

The ItemClick event supplies all the necessary information to the application, so appropriate action can be taken. The application can start cell editing, expand or collapse an item or display application specific information based on the event and the area clicked.

The ItemDoubleClick event can be used to respond to a mouse button that is pressed twice within a short time. An ItemDoubleClick event is always preceded by an ItemClick event. If the pause between mouse clicks is longer than the system's double-click time, a second ItemClick event occurs instead of the ItemDoubleClick event.

If the ItemClick event is used to display a context sensitive menu (popup menu), the SoftelvdmUserControl.CancelMode method must be used before displaying the context menu.

Examples

C#

            DumpValues("HeaderHeightChanged", e);
        }

        private void sftTree1_HorizontalOffsetChanged(object sender, Softelvdm.SftTreeNET.HorizontalOffsetChangedEventArgs e) {
            DumpValues("HorizontalOffsetChanged", e);
        }

        private void sftTree1_ItemClick(object sender, Softelvdm.SftTreeNET.ItemClickEventArgs e) {
            DumpValues("ItemClick", e);

            if (e.Item != null && e.Cell != null && e.Item.UsageLocation == UsageLocationEnum.items && e.Cell.ColumnIndex == 2)
                e.Cell.Edit();  // Start cell editing

        }

        private void sftTree1_ItemCollapsed(object sender, Softelvdm.SftTreeNET.ItemCollapsedEventArgs e) {

VB.NET

Private Sub SftTree1_HeaderHeightChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SftTree1.HeaderHeightChanged
    DumpValues("HeaderHeightChanged", e)
End Sub

Private Sub SftTree1_HorizontalOffsetChanged(ByVal sender As System.Object, ByVal e As Softelvdm.SftTreeNET.HorizontalOffsetChangedEventArgs) Handles SftTree1.HorizontalOffsetChanged
    DumpValues("HorizontalOffsetChanged ", e)
End Sub

Private Sub SftTree1_ItemClick(ByVal sender As System.Object, ByVal e As Softelvdm.SftTreeNET.ItemClickEventArgs) Handles SftTree1.ItemClick
    DumpValues("ItemClick", e)

        If Not e.Item Is Nothing And Not e.Cell Is Nothing Then
            If e.Item.UsageLocation = UsageLocationEnum.items And e.Cell.ColumnIndex = 2 Then
                e.Cell.Edit()  ' Start cell editing
            End If
        End If

See Also SftTree Class | Classes | SftTree/NET 3.0