Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxItems.Selection Property

Defines the currently selected item.

Syntax

Get

VB.NETItemIndex = object.Selection As Integer
VBItemIndex = object.Selection As Long
C#.NETint ItemIndex = object.Selection;
VC++long ItemIndex = object->Selection;
long ItemIndex = object->GetSelection();
CHRESULT object->get_Selection(long* ItemIndex);

Put

VB.NETobject.Selection = ItemIndex As Integer
VBobject.Selection = ItemIndex As Long
C#.NETint object.Selection = ItemIndex;
VC++long object->Selection = ItemIndex;
void object->PutSelection(long ItemIndex);
CHRESULT object->put_Selection(long ItemIndex);

object

A SftBoxItems object.

ItemIndex

The zero-based index of the selected item. If no item is selected this value is -1.

Comments

The Selection property defines the currently selected item.

The SelectionChange event notifies an application when the selection is changed.

Examples

VB.NET

    Application.Exit()
End Sub

Private Sub CopyImageFromCurrentItem()

    Dim ItemIndex As Integer
    Dim Img As SftPictureObject

    ItemIndex = AxSftBox1.Items.Selection
    If ItemIndex < 0 Then Exit Sub

    ' don't use images that are too large in the other areas
    Img = AxSftBox1.get_Cell(ItemIndex, 0).Image
    If Img.ActualHeight <= 20 And Img.ActualWidth <= 20 Then
        AxSftBox1.RowColumnHeader.Image = Img
        AxSftBox1.get_Header(1).Image = Img

VB6

Option Explicit

Dim SortDirection As Boolean

Private Sub CopyImageFromCurrentItem()
    Dim ItemIndex As Integer
    Dim Img As SftPictureObject

    ItemIndex = SftBox1.Items.Selection
    If ItemIndex < 0 Then Exit Sub

    ' don't use images that are too large in the other areas
    Set Img = SftBox1.Cell(ItemIndex, 0).Image
    If Img.ActualHeight <= 20 And Img.ActualWidth <= 20 Then
        SftBox1.RowColumnHeader.Image = Img
        SftBox1.Header(1).Image = Img

C#

    Application.Exit();
}

private void CopyImageFromCurrentItem()
{
    int ItemIndex;
    SftPictureObject Img;

    ItemIndex = axSftBox1.Items.Selection;
    if (ItemIndex < 0)
        return;

    // don't use images that are too large in the other areas
    Img = axSftBox1.get_Cell(ItemIndex, 0).Image;
    if (Img.ActualHeight <= 20 && Img.ActualWidth <= 20) {
        axSftBox1.RowColumnHeader.Image = Img;

C++

    AddBuiltinImage(_T("Enabled Descending Indicator"), sftImageSortDesc, 8, 8);
    AddBuiltinImage(_T("Disabled Descending Indicator"), sftImageSortDescDisabled, 8, 8);


    m_vBox->RowHeaders->MakeOptimal(0); // make the row headers optimal
    m_vBox->Column[0]->MakeOptimal(0); // make the first column optimal
    m_vBox->Items->RecalcHorizontalExtent(0); // update horizontal scroll bar

    m_vBox->Items->Selection = 0;

    CopyImageFromCurrentItem();

    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CPicturesDlg::PropagateImage(long ItemIndex, ISftPictureObjectPtr Img)

See Also SftBoxItems Object | Object Hierarchy


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