Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Current Property, SftTreeItems Object

Defines the current item (caret location).

Syntax

Get

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

Put

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

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

VB.NET

    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

VB6

    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

C#

            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;
        }

C++

    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
}

See Also SftTreeItems Object | Object Hierarchy


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