Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Selected Property, SftTreeItem Object

Defines whether the item is selected.

Syntax

Get

VB.NETBoolean = object.Selected As Boolean
VBBoolean = object.Selected As Boolean
C#.NETbool Boolean = object.Selected;
VC++VARIANT_BOOL Boolean = object->Selected;
VARIANT_BOOL Boolean = object->GetSelected();
CHRESULT object->get_Selected(VARIANT_BOOL* Boolean);

Put

VB.NETobject.Selected = Boolean As Boolean
VBobject.Selected = Boolean As Boolean
C#.NETbool object.Selected = Boolean;
VC++VARIANT_BOOL object->Selected = Boolean;
void object->PutSelected(VARIANT_BOOL Boolean);
CHRESULT object->put_Selected(VARIANT_BOOL Boolean);

object

A SftTreeItem object.

Boolean

Defines whether the item is selected.

BooleanDescription
TrueThe item is selected.
FalseThe item is not selected.

Comments

The Selected property defines whether the item is selected.

The Items.SelectRange method can be used to select a range of items at one time. Items can be selected individually using the Item.Selected property.

The Items.Selection property returns the index of one or more selected items. The Items.SelectionGroupStart and Items.SelectionGroupEnd properties are used to retrieve groups of selected items.

Examples

VB.NET

    AxSftTree1.ColumnsObj.MakeOptimal() ' Make all columns optimal

    ' triple the size of the last column
    AxSftTree1.get_Column(1).WidthPix = AxSftTree1.get_Column(1).WidthPix * 3

    AxSftTree1.Items.RecalcHorizontalExtent() ' Update horizontal scrollbar

    AxSftTree1.Items.Current = 0 ' select the first item
    AxSftTree1.get_Item(0).Selected = True

    AxSftTree1.Dock = DockStyle.Fill ' Maximize the main window

    Me.WindowState = FormWindowState.Maximized
End Sub

Private Sub AxSftTree1_ItemExpanded(ByVal sender As System.Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_ItemExpandedEvent) Handles AxSftTree1.ItemExpanded

VB6

    SftTree1.Item(6).Cell(1).Text = ""

    ' triple the size of the last column
    SftTree1.Column(1).WidthPix = SftTree1.Column(1).WidthPix * 3

    SftTree1.Items.RecalcHorizontalExtent ' Update horizontal scrollbar

    SftTree1.Items.Current = 0 ' select the first item
    SftTree1.Item(0).Selected = True

    Me.WindowState = 2 ' Maximize the main window
End Sub

Private Sub Form_Unload(Cancel As Integer)
    ' clean up
    Unload SavedForm

C#

            axSftTree1.ColumnsObj.MakeOptimal(); // Make all columns optimal

            // triple the size of the last column
            axSftTree1.get_Column(1).WidthPix = axSftTree1.get_Column(1).WidthPix * 3;

            axSftTree1.Items.RecalcHorizontalExtent(); // Update horizontal scrollbar

            axSftTree1.Items.Current = 0; // select the first item
            axSftTree1.get_Item(0).Selected = true;

            axSftTree1.Dock = DockStyle.Fill; // Maximize the main window

            this.WindowState = FormWindowState.Maximized;
        }

        private void axSftTree1_ItemExpanded(object sender, _DSftTreeEvents_ItemExpandedEvent e) {

C++

    m_vTree->ColumnsObj->MakeOptimal(); // Make all columns optimal

    // triple the size of the last column
    m_vTree->Column[1]->WidthPix = m_vTree->Column[1]->WidthPix * 3;

    m_vTree->Items->RecalcHorizontalExtent(); // Update horizontal scrollbar

    m_vTree->Items->Current = 0; // select the first item
    m_vTree->Item[0]->Selected = VARIANT_TRUE;

    SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);

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

// If you add a minimize button to your dialog, you will need the code below

See Also SftTreeItem Object | Object Hierarchy


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