Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBox.ItemClick Event

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 Part As SftBoxPortionConstants, ByVal AreaType As SftBoxAreaConstants, ByVal ItemIndex As Long, ByVal ColNum As Integer, ByVal Button As Integer, ByVal Shift As Integer)
C#.NETvoid object_ItemClick(object sender, EventArgumentType e);
VC++void OnItemClickobject(enum SftBoxPortionConstants Part, enum SftBoxAreaConstants AreaType, long ItemIndex, short ColNum, short Button, short Shift);
CHRESULT OnItemClickobject(enum SftBoxPortionConstants Part, enum SftBoxAreaConstants AreaType, long ItemIndex, short ColNum, short Button, short Shift);

object

A SftBox object.

Part

Describes the area where the mouse button was clicked.

PartValueDescription
partSftBoxStatic1Static portion
partSftBoxEdit2Edit control portion
partSftBoxDropDown3Drop down portion

AreaType

Describes the area where the mouse button was clicked.

AreaTypeValueDescription
areaSftBoxLabel0The label picture was clicked. ItemIndex has the item's index. ColNum is undefined.
areaSftBoxTree1The area where tree lines are shown was clicked. ItemIndex has the item's index. ColNum is undefined.
areaSftBoxItem2The item picture was clicked. ItemIndex has the item's index. ColNum is undefined.
areaSftBoxCell3A cell was clicked. ItemIndex and ColNum describe the cell. If the cell graphic was clicked, the value areaSftBoxCellGraphic is used instead.
areaSftBoxColumn4A column header was clicked. ColNum has the column number. ItemIndex is undefined.
areaSftBoxRowCol5The row/column header was clicked. ItemIndex and ColNum are undefined.
areaSftBoxRow6A row header was clicked. ItemIndex has the item's index. ColNum is undefined.
areaSftBoxCellGraphic8A cell graphic was clicked. ItemIndex and ColNum describe the cell.
areaSftBoxButton <sup>1)</sup>9The mouse button was pressed on the expand/collapse button. ColNum is undefined.
areaSftBoxStatic15The static portion was clicked. ItemIndex and ColNum describe the cell.

ItemIndex

The zero-based index of the item or undefined depending on AreaType.

ColNum

The zero-based column number where the operation has been detected or undefined depending on AreaType.

Button

Describes the button(s) that are pressed. 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. The bits set indicate the button that caused the event.

ButtonValueDescription
constSftBoxLeftButton1The left mouse button was pressed.
constSftBoxRightButton2The middle mouse button was pressed.
constSftBoxMiddleButton4The right mouse button was pressed.

Shift

Describes the state of the SHIFT, CONTROL and ALT keys. 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. It indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftBoxShiftMask1The SHIFT key is down.
constSftBoxCtrlMask2The CONTROL key is down.
constSftBoxAltMask4The ALT key is down.

Comments

The ItemClick event occurs when a mouse button is clicked.

<sup>1)</sup> If the AutoRespond property is set to True, the area areaSftBoxButton does not generate an ItemClick event for the left mouse button. The combo box control responds by expanding/collapsing the items automatically. The middle and right mouse buttons still generate the event in those areas.

The ItemClick event describes what component of the combo box control was clicked using a combination of Part and AreaType.

Once an ItemClick or ItemDblClk event is processed, the drop down portion may automatically become visible or may be hidden in response. This default action is built into the control. It is possible to suppress the default response by using the DropDown.Suppress method while handling the ItemClick or ItemDblClk event.

The edit control portion does not generate an ItemClick event. The MouseDown and MouseUp events can be used instead.

Certain mouse events, such as clicking on a cell of the drop down portion will select the item and automatically hide the drop down portion. This automatic hiding of the drop down portion can be suppressed using the DropDown.Suppress method. Similarly, clicking on the static portion usually will show the drop down portion. This can also be suppressed using the DropDown.Suppress method.

The ItemDblClk event can be used to respond to double-clicks.

The SelectionChange event occurs when the current selection is changed. While the ItemClick event may indicate a selection change, the SelectionChange event should be used when tracking selections.

Examples

VB.NET

    Item = AxSftBox1.get_Item(ItemIndex)
    If Item.Expanded Then
        Item.Collapse(True)
    Else
        Item.Expand(True, (Shift And SftBoxKeyConstants.constSftBoxCtrlMask))
    End If
End Sub

Private Sub AxSftBox1_ItemClick(ByVal sender As Object, ByVal e As AxSftBoxLib50._ISftBoxEvents_ItemClickEvent) Handles AxSftBox1.ItemClick
    Select Case e.areaType
    Case SftBoxAreaConstants.areaSftBoxColumn
        If e.colNum = 0 Then
            SetSortDirection(Not m_SortDirection)
        End If
    Case SftBoxAreaConstants.areaSftBoxCellGraphic
        If e.part = SftBoxPortionConstants.partSftBoxDropDown Then

VB6

    Set Item = SftBox1.Item(ItemIndex)
    If Item.Expanded Then
        Item.Collapse True
    Else
        Item.Expand True, (Shift And constSftBoxCtrlMask)
    End If
End Sub

Private Sub SftBox1_ItemClick(ByVal Part As SftBoxLib50.SftBoxPortionConstants, ByVal AreaType As SftBoxLib50.SftBoxAreaConstants, ByVal ItemIndex As Long, ByVal ColNum As Integer, ByVal Button As Integer, ByVal Shift As Integer)
    Select Case AreaType
    Case areaSftBoxColumn
        If ColNum = 0 Then
            SetSortDirection Not SortDirection
        End If
    Case areaSftBoxCellGraphic
        If Part = partSftBoxDropDown Then SftBox1.DropDown.Suppress ' Make sure we don't close the drop down

C#

{
    SftBoxItem Item = axSftBox1.get_Item(ItemIndex);
    if (Item.Expanded)
        Item.Collapse(true);
    else
        Item.Expand(true, ((Shift & (short)SftBoxKeyConstants.constSftBoxCtrlMask))!=0 ? true : false);
}

private void axSftBox1_ItemClick(object sender, AxSftBoxLib50._ISftBoxEvents_ItemClickEvent e)
{
    switch (e.areaType) {
    case SftBoxAreaConstants.areaSftBoxColumn:
        if (e.colNum == 0)
            SetSortDirection(!m_SortDirection);
        break;
    case SftBoxAreaConstants.areaSftBoxCellGraphic:

C++

    ISftBoxItemPtr pItem;
    pItem = m_vBox->Item[ItemIndex];
    if (pItem->Expanded != VARIANT_FALSE)
        pItem->Collapse(VARIANT_TRUE);
    else
        pItem->Expand(VARIANT_TRUE, (Shift & constSftBoxCtrlMask) ? VARIANT_TRUE : VARIANT_FALSE);
}

void CPicturesDlg::OnItemClickSftBox1(long Part, long AreaType, long ItemIndex, short ColNum, short Button, short Shift)
{
    switch (AreaType) {
    case areaSftBoxColumn:
        if (ColNum == 0)
            SetSortDirection(!m_fSortDirection);
        break;
    case areaSftBoxCellGraphic:

See Also SftBox Object | Object Hierarchy


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