Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

ID Property, SftTreeItem Object

Defines the item ID of the item.

Syntax

Get

VB.NETItemID = object.ID As Integer
VBItemID = object.ID As Long
C#.NETint ItemID = object.ID;
VC++long ItemID = object->ID;
long ItemID = object->GetID();
CHRESULT object->get_ID(long* ItemID);

Put

VB.NETobject.ID = ItemID As Integer
VBobject.ID = ItemID As Long
C#.NETint object.ID = ItemID;
VC++long object->ID = ItemID;
void object->PutID(long ItemID);
CHRESULT object->put_ID(long ItemID);

object

A SftTreeItem object.

ItemID

Defines the item ID of the item.

Comments

The ID property defines the item ID of the item.

The tree control automatically assigns a unique item ID to items as they are added to the control. The item ID defined by the ID property does not change throughout the lifetime of an item. Even if an item changes its index position because other items are deleted or inserted, the item ID remains constant.

An application can change an item's item ID using the ID property. In this case, if a unique item ID is required, the application must insure using its own mechanisms that unique IDs are used.

The item index describes the zero-based position of an item in a tree control.

An item ID can be translated into an item index using the Items.ItemIndex property.

Examples

VB.NET

        AxSftTree1.get_Cell(ItemIndex, 0).Font = m_BoldFont

        ' if this folder has no messages (ie. dependents), we still want the
        ' folder graphic, not the email (leaf) graphic
        If Count = 0 Then
            AxSftTree1.get_Item(ItemIndex).Image = AxSftTree1.Items.ItemImageExpandable
        End If

        AddFolder = AxSftTree1.get_Item(ItemIndex).ID
    End Function

    Private Function AddMessage(ByVal Level As Integer, ByVal Email As String, ByVal Desc As String, ByVal Dt As String, ByVal Size As Integer, ByVal Attachment As Boolean) As Integer
        Dim ItemIndex As Integer
        ItemIndex = AxSftTree1.Items.Add(Email) ' add folder
        AxSftTree1.get_Item(ItemIndex).Level = Level
        AxSftTree1.get_Cell(ItemIndex, 1).Text = Desc ' add description

VB6

        ' make the folder name bold
        .Cell(ItemIndex, 0).Font.Bold = True

        ' if this folder has no messages (ie. dependents), we still want the
        ' folder graphic, not the email (leaf) graphic
        If Count = 0 Then
            .Item(ItemIndex).Image = .Items.ItemImageExpandable
        End If
        AddFolder = .Item(ItemIndex).ID
    End With
End Function

Private Function AddMessage(ByVal Level As Integer, ByVal Email As String, ByVal Desc As String, ByVal Dt As String, ByVal Size As Integer, ByVal Attachment As Boolean)
    Dim ItemIndex As Long
    With SftTree1
        ItemIndex = .Items.Add(Email)    ' add folder

C#

            }
            axSftTree1.get_Cell(ItemIndex, 0).Font = m_BoldFont;

            // if this folder has no messages (ie. dependents), we still want the
            // folder graphic, not the email (leaf) graphic
            if (Count == 0)
                axSftTree1.get_Item(ItemIndex).Image = axSftTree1.Items.ItemImageExpandable;

            return axSftTree1.get_Item(ItemIndex).ID;
        }

        private int AddMessage(short Level, string Email, string Desc, string Dt, int Size, bool Attachment)
        {
            int ItemIndex = axSftTree1.Items.Add(Email); // add folder
            axSftTree1.get_Item(ItemIndex).Level = Level;
            axSftTree1.get_Cell(ItemIndex, 1).Text = Desc; // add description

C++

    // make the folder name bold
    IFontDispPtr pFont = m_pBoldCellFont;
    m_vTree->Cell[ItemIndex][0]->PutRefFont(pFont);

    // if this folder has no messages (ie. dependents), we still want the
    // folder graphic, not the email (leaf) graphic
    if (Count == 0)
        m_vTree->Item[ItemIndex]->Image = m_vTree->Items->ItemImageExpandable;
    return m_vTree->Item[ItemIndex]->ID;
}

long CEmailDlg::AddMessage(int Level, LPCTSTR lpszEmail, LPCTSTR lpszDesc, LPCTSTR lpszDt, int Size, BOOL Attachment)
{
    long ItemIndex;
    ItemIndex = m_vTree->Items->Add(lpszEmail); // add folder
    m_vTree->Item[ItemIndex]->Level = Level;

See Also SftTreeItem Object | Object Hierarchy


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


Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.