Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

ItemClick Event, SftTree Object

A mouse button is clicked.

Syntax

VB.NETPrivate Sub object_ItemClick(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.ItemClick
VBPrivate Sub object_ItemClick(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal AreaType As Integer, ByVal Button As Integer, ByVal Shift As Integer)
C#.NETvoid object_ItemClick(object sender, EventArgumentType e);
VC++void OnItemClickobject(long ItemIndex, short ColIndex, short AreaType, short Button, short Shift);
CHRESULT OnItemClickobject(long ItemIndex, short ColIndex, short AreaType, short Button, short Shift);

object

A SftTree object.

ItemIndex

The zero-based index of the item at the mouse-cursor location when the mouse button was clicked. If the area described by AreaType doesn't require item information, this value is undefined.

ColIndex

The column number of the cell at the mouse-cursor location when the mouse button was clicked. If the area described by AreaType doesn't require column information, this value is undefined.

AreaType

Defines the area where the mouse button was clicked (see SftTreeAreaTypeConstants).

AreaTypeValueDescription
constSftTreeLabel0The mouse button was pressed on the label graphic. ColIndex is undefined.
constSftTreePlusMinus 2)1The mouse button was pressed on the plus/minus graphic. ColIndex is undefined.
constSftTreeTree2The mouse button was pressed in the area where the connecting tree lines are shown. ColIndex is undefined.
constSftTreeButton 2)3The mouse button was pressed on the expand/collapse button. ColIndex is undefined.
constSftTreeItem4The mouse button was pressed on the item graphic. ColIndex is undefined.
constSftTreeText5The mouse button was pressed inside a cell (text or graphic). To distinguish between cell text and cell graphic use constSftTreeCellText or constSftTreeCellGraphic instead. Preceding the ItemClick event with this AreaType value, an ItemClick event occurs with an AreaType value of constSftTreeCellText or constSftTreeCellGraphic.
constSftTreeColumnHeader6The mouse button was pressed on the column header. ItemIndex is undefined.
constSftTreeColumn6Deprecated - Use constSftTreeColumnHeader instead. The mouse button was pressed on the column header. ItemIndex is undefined.
constSftTreeRowColumnHeader7The mouse button was pressed on the row/column header. ItemIndex and ColIndex are undefined.
constSftTreeRowColumn7Deprecated - Use constSftTreeRowColumnHeader instead. The mouse button was pressed on the row/column header. ItemIndex and ColIndex are undefined.
constSftTreeRow8The mouse button was pressed on the row header. ColIndex is undefined.
constSftTreeCellText9The mouse button was pressed inside a cell, but not on the cell graphic.
constSftTreeCellGraphic10The mouse button was pressed inside a cell on the cell graphic.
constSftTreeColumnRes11Not used.
constSftTreeExpandAll12The ExpandAll key (the * on the numeric keypad) was pressed. ItemIndex and ColIndex are undefined.
constSftTreeRowColumnFooter14The mouse button was pressed on the row/column footer. ItemIndex and ColIndex are undefined.
constSftTreeColumnFooter15The mouse button was pressed on the column footer. ItemIndex is undefined.
constSftTreeColumnHeaderButton16The header dropdown/filter button was clicked.
constSftTreeColumnFooterButton17The footer dropdown/filter button was clicked.

Button

The button that is pressed during the event (see SftTreeButtonConstants). The button argument is a bit field with bits corresponding to the left button, right button and middle button. These bits correspond to the values shown below. Only one of the bits is set, indicating the button that caused the event.

ButtonValueDescription
constSftTreeLeftButton1The left mouse button was pressed.
constSftTreeRightButton 1)2The right mouse button was pressed.
constSftTreeMiddleButton 1)4The middle mouse button was pressed.

Shift

The state of the SHIFT, CONTROL and ALT keys during the event (see SftTreeKeyConstants). A bit is set if the key is down. The Shift argument is a bit field with bits corresponding to the SHIFT, CONTROL and ALT keys. The Shift variable indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftTreeShiftMask1The SHIFT key was pressed.
constSftTreeCtrlMask2The CONTROL key was pressed.
constSftTreeAltMask4The ALT key was pressed.

Comments

The ItemClick event occurs when a mouse button is clicked.

1) Depending on the settings of the LeftButtonOnly or LeftItemClickOnly properties, this event may not be generated for the middle and right mouse buttons.

2) If the AutoRespond property is set to True, the areas constSftTreePlusMinus, constSftTreeButton do not generate an ItemClick event for the left mouse button. The tree control responds by expanding/collapsing the items automatically. The middle and right mouse buttons still generate the event in those areas.

Please note that the ItemClick event reflects mouse button events. The SelectionChange event should be used when selection changes need to be tracked, as these can also occur though 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 ItemDblClick event can be used to respond to a mouse button that is pressed twice within a short time. An ItemDblClick event is always preceded by an ItemClick event. If the pause between mouse click events is sufficiently long, the ItemClickAgain event may be generated instead of the ItemDblClick event.

The ItemClick event with AreaType constSftTreeColumnHeader is only generated if column headers are displayed as buttons (Headers.Appearance property), the header button is enabled (Header.Enabled property) and is not currently in its "down" position (Headers.Pressed property). The ItemClick event with AreaType constSftTreeColumnFooter is only generated if column footers are displayed as buttons (Footers.Appearance property), the footer button is enabled (Footer.Enabled property) and is not currently in its "down" position (Footers.Pressed property).

The ItemClick event with AreaType constSftTreeRowColumnHeader is only generated if a row/column header is currently displayed as a button (RowColumnHeader.Appearance property) and is enabled (RowColumnHeader.Enabled property). The ItemClick event with AreaType constSftTreeRowColumnFooter is only generated if a row/column footer is currently displayed as a button (RowColumnFooter.Appearance property) and is enabled (RowColumnFooter.Enabled property).

The ItemClick event with AreaType constSftTreeRow is only generated if row headers are displayed as buttons (RowHeaders.Appearance property) and are enabled (RowHeaders.Enabled property). An ItemClick in this area acts as a selection.

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

Examples

VB.NET

        AxSftTree1.Items.RecalcHorizontalExtent() ' update horizontal scroll bar

        AxSftTree1.get_Item(0).Selected = True
        AxSftTree1.Items.Current = 0

        CopyImageFromCurrentItem()
    End Sub

    Private Sub AxSftTree1_ItemClick(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_ItemClickEvent) Handles AxSftTree1.ItemClick
        Dim AreaType As SftTreeAreaTypeConstants
        AreaType = e.areaType
        If AreaType = SftTreeAreaTypeConstants.constSftTreeExpandAll Then
            AxSftTree1.get_Item(e.itemIndex).Expand(True, True)
        ElseIf AreaType = SftTreeAreaTypeConstants.constSftTreeColumn And e.colIndex = 0 Then
            SetSortDirection(Not m_SortDirection)
        ElseIf AreaType = SftTreeAreaTypeConstants.constSftTreeCellGraphic Then

VB6

        .Item(0).Selected = True
        .Items.Current = 0

        CopyImageFromCurrentItem

    End With
End Sub

Private Sub SftTree1_ItemClick(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal AreaType As Integer, ByVal Button As Integer, ByVal Shift As Integer)
    Dim Area As SftTreeAreaTypeConstants
    Area = AreaType
    If Area = constSftTreeExpandAll Then
        SftTree1.Item(ItemIndex).Expand True, True
    ElseIf Area = constSftTreeColumn And ColIndex = 0 Then
        SetSortDirection Not SortDirection
    ElseIf Area = constSftTreeCellGraphic Then

C#

            axSftTree1.Items.RecalcHorizontalExtent(); // update horizontal scroll bar

            axSftTree1.get_Item(0).Selected = true;
            axSftTree1.Items.Current = 0;

            CopyImageFromCurrentItem();
        }

        private void axSftTree1_ItemClick(object sender, AxSftTreeLib75._DSftTreeEvents_ItemClickEvent e)
        {
            SftTreeAreaTypeConstants areaType = (SftTreeAreaTypeConstants) e.areaType;
            if (areaType == SftTreeAreaTypeConstants.constSftTreeExpandAll)
                axSftTree1.get_Item(e.itemIndex).Expand(true, true);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeColumn && e.colIndex == 0)
                SetSortDirection(!m_SortDirection);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeCellGraphic)

C++

        m_vTree->RowColumnHeader->Image = pImg;
        m_vTree->Header[1]->Image = pImg;
    } else {
        m_vTree->RowColumnHeader->Image->Clear();
        m_vTree->Header[1]->Image->Clear();
    }
}

void CPicturesDlg::OnItemClickSftTree1(long ItemIndex, short ColIndex, short AreaType, short Button, short Shift)
{
    if (AreaType == constSftTreeExpandAll)
        m_vTree->Item[ItemIndex]->Expand(VARIANT_TRUE, VARIANT_TRUE);
    else if (AreaType == constSftTreeColumn && ColIndex == 0)
        SetSortDirection(!m_fSortDirection);
    else if (AreaType == constSftTreeCellGraphic)
        ToggleImage(m_vTree->Cell[ItemIndex][ColIndex]->Image);

See Also SftTree Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.