HeaderPane
Main
Hide
Share Link
Print

Current Property, SftTreeItems Object

Defines the current item (caret location).

Syntax

Get

C#int ItemIndex = object.Current;
VB.NETItemIndex = object.Current As Integer
C++long ItemIndex = object->Current;
long ItemIndex = object->GetCurrent();
CHRESULT object->get_Current(long* ItemIndex);
VBItemIndex = object.Current As Long

Put

C#int object.Current = ItemIndex;
VB.NETobject.Current = ItemIndex As Integer
C++long object->Current = ItemIndex;
void object->PutCurrent(long ItemIndex);
CHRESULT object->put_Current(long ItemIndex);
VBobject.Current = ItemIndex As Long

object

A SftTreeItems object.

ItemIndex

Defines the current item (caret location).

Comments

The Current property defines the current item (caret location).

The Current property describes the current item, which is the item that has the focus rectangle. This item is not necessarily also selected. The current item is described by the Current property, the currently selected item is described by the Items.Selection property. These are not necessarily the same even in a single-selection tree control (see Items.NoSelection property).

When the user changes the current item (caret location), the CaretChange event occurs. The SelectionChange event occurs when the selection changes.

If the tree control is empty, the Current property returns -1. An application must set the property to a valid, existing item. It cannot set it to -1.

The focus rectangle can be hidden using the Items.ShowFocusRectangle property.

Examples

C# View entire sample code

            axSftTree1.RowHeaders.MakeOptimal(); // Make row header width optimal, so text and pictures are not clipped horizontally.
            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;
        }

VB.NET View entire sample code

    AxSftTree1.RowHeaders.MakeOptimal() ' Make row header width optimal, so text and pictures are not clipped horizontally.
    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

C++ View entire sample code

    m_vTree->RowHeaders->MakeOptimal(); // Make row header width optimal, so text and pictures are not clipped horizontally.
    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
}

VB6 View entire sample code

    SftTree1.Item(6).Cell(1).AttachContentWindow SavedForm.hWnd, contentWindowSftTreeKeepSize
    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

See Also SftTreeItems Object | Object Hierarchy


Last Updated 11/03/2026 - (email)
© 2026 Softel vdm, Inc.