Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Data Property, SftTreeItem Object

Defines the item's application specific numeric value.

Syntax

Get

VB.NETNumber = object.Data As Integer
VBNumber = object.Data As Long
C#.NETint Number = object.Data;
VC++long Number = object->Data;
long Number = object->GetData();
CHRESULT object->get_Data(long* Number);

Put

VB.NETobject.Data = Number As Integer
VBobject.Data = Number As Long
C#.NETint object.Data = Number;
VC++long object->Data = Number;
void object->PutData(long Number);
CHRESULT object->put_Data(long Number);

object

A SftTreeItem object.

Number

Defines the item's application specific numeric value.

Comments

The Data property defines the item's application specific numeric value.

The Data property can be used to store an application specific value with an item. Possible uses include storing values used for sorting purposes (see Items.SortDependents method).

Additional properties used to associate an application defined value with an item are Item.DataFloat, Item.DataObject, Item.DataString and Item.DataTag. These are distinct properties and can be used at the same time.

Cell related data can be saved using the Cell.Data, Cell.DataObject, Cell.DataString and Cell.DataTag properties.

Examples

VB.NET

            AxSftTree1.get_Cell(bookIndex, 1).Text = "Description for book " + bk.ToString()
            Dim size As Integer
            If bk = 1 Then
                size = R.Next(1, 99)
            Else
                size = R.Next(1, 999)
            End If
            AxSftTree1.get_Cell(bookIndex, 2).Text = size.ToString()
            AxSftTree1.get_Item(bookIndex).Data = size
            ' add chapters
            Dim ch As Integer
            For ch = 1 To 2
                Dim index As Integer
                index = AxSftTree1.Items.Add("Chapter " & ch)
                AxSftTree1.get_Item(index).Level = 1
                ' add sections

VB6

        ' Add all available options
        For Bk = 1 To 4
            ' add a book
            BookIndex = .Items.Add("Book " & Bk)

            .Cell(BookIndex, 1).Text = "Description for book " & Bk
            size = Int((1000 * Rnd) + 1)
            .Cell(BookIndex, 2).Text = size
            .Item(BookIndex).Data = size
            ' add chapters
            For Ch = 1 To 2
                ItemIndex = .Items.Add("Chapter " & Ch)
                .Item(ItemIndex).Level = 1
                ' add sections
                For Sect = 1 To 2
                    ItemIndex = .Items.Add("Section " & Sect)

C#

            for (int bk = 1 ; bk <= 4 ; ++bk) {
                // add a book
                int bookIndex = axSftTree1.Items.Add("Book " + bk.ToString());

                axSftTree1.get_Cell(bookIndex, 1).Text = "Description for book " + bk.ToString();
                int size = random.Next(1, bk == 1 ? 99 : 999);
                axSftTree1.get_Cell(bookIndex, 2).Text = size.ToString();
                axSftTree1.get_Item(bookIndex).Data = size;
                // add chapters
                for (int ch = 1 ; ch <= 2 ; ++ch) {
                    int index = axSftTree1.Items.Add("Chapter " + ch.ToString());
                    axSftTree1.get_Item(index).Level = 1;
                    // add sections
                    for (int sect = 1 ; sect <= 2 ; ++sect) {
                        index = axSftTree1.Items.Add("Section " + sect.ToString());
                        axSftTree1.get_Item(index).Level = 2;

C++

        long BookIndex = m_vTree->Items->Add(_bstr_t(str));

        str.Format(_T("Description for book %d"), bk);
        m_vTree->Cell[BookIndex][1]->Text = (_bstr_t)str;

        int size = (rand() % 999) + 1;
        str.Format(_T("%d"), size);
        m_vTree->Cell[BookIndex][2]->Text = (_bstr_t)str;
        m_vTree->Item[BookIndex]->Data = size;

        // add chapters
        for (int ch = 1 ; ch <= 2 ; ++ch) {
            str.Format(_T("Chapter %d"), ch);
            long Index = m_vTree->Items->Add((_bstr_t)str);
            m_vTree->Item[Index]->Level = 1;
            // add sections

See Also SftTreeItem Object | Object Hierarchy


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