Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxItem.Collapse Method

Collapses the item so its dependents are no longer visible.

Syntax

VB.NETobject.Collapse(ByVal Preserve As Boolean)
VBobject.Collapse(ByVal Preserve As Boolean)
C#.NETvoid object.Collapse(bool Preserve);
VC++HRESULT object->Collapse(VARIANT_BOOL Preserve);
CHRESULT object->raw_Collapse(VARIANT_BOOL Preserve);

object

A SftBoxItem object.

Preserve

Defines whether the expand/collapse state is preserved.

PreserveDescription
TruePreserves the expand/collapse state of dependent items that are made no longer visible. A subsequent call to Items.Expand or Item.Expand will restore the items with the remembered expand/collapse state.
FalseThe expand/collapse state is not preserved.

Comments

The Collapse method collapses the item so its dependents are no longer visible.

The Collapse method collapses all dependent items of the item and saves the expand/collapse state of all dependent items, so it can be restored by a subsequent Items.Expand or Item.Expand method call.

If a parent item is collapsed, subsequently adding child items will automatically expand the item.

The drop down portion is automatically hidden when the combo box contents are changed using this method. The DropDown.SuppressOn method can be used to suppress hiding the drop down portion when adding/inserting items.

Examples

VB.NET

    CopyImageFromCurrentItem()
End Sub

Private Sub ExpandCollapseItem(ByVal ItemIndex As Long, ByVal Shift As Short)
    Dim Item As SftBoxItem
    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

VB6

    SftBox1.DropDown.Dropped = True
End Sub

Private Sub ExpandCollapseItem(ByVal ItemIndex As Long, ByVal Shift As Integer)
    Dim Item As SftBoxItem
    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

C#

    CopyImageFromCurrentItem();
}

private void ExpandCollapseItem(int ItemIndex, short Shift)
{
    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:

C++

    }
}

void CPicturesDlg::ExpandCollapseItem(long ItemIndex, short Shift)
{
    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) {

See Also SftBoxItem Object | Object Hierarchy


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