Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Enabled Property, SftTreeItem Object

Defines whether the item is enabled.

Syntax

Get

VB.NETBoolean = object.Enabled As Boolean
VBBoolean = object.Enabled As Boolean
C#.NETbool Boolean = object.Enabled;
VC++VARIANT_BOOL Boolean = object->Enabled;
VARIANT_BOOL Boolean = object->GetEnabled();
CHRESULT object->get_Enabled(VARIANT_BOOL* Boolean);

Put

VB.NETobject.Enabled = Boolean As Boolean
VBobject.Enabled = Boolean As Boolean
C#.NETbool object.Enabled = Boolean;
VC++VARIANT_BOOL object->Enabled = Boolean;
void object->PutEnabled(VARIANT_BOOL Boolean);
CHRESULT object->put_Enabled(VARIANT_BOOL Boolean);

object

A SftTreeItem object.

Boolean

Defines whether the item is enabled.

BooleanDescription
TrueThe item is enabled.
FalseThe item is disabled. It is drawn in a "grayed" manner indicating its status.

Comments

The Enabled property defines whether the item is enabled.

The DisabledItemsSelectable property can be used to prevent an end-user from selecting disabled items. Items can always be selected by an application. DisabledItemsSelectable only controls whether the end-user can select an item.

Examples

VB.NET

    Private Sub AxSftTree1_VirtualItem(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_VirtualItemEvent) Handles AxSftTree1.VirtualItem
        e.itemObject.Item.Cell(0).Text = "Item " & e.rowIndex
        e.itemObject.Item.Cell(1).Text = "Cell " & e.rowIndex
        e.itemObject.Item.Cell(2).Text = "A"
        e.itemObject.Item.Cell(3).Text = (e.rowIndex Mod 7)
        e.itemObject.Item.Cell(4).Text = "Last " & e.rowIndex
        e.itemObject.Item.RowHeader.Text = "R" & e.rowIndex
        e.itemObject.Item.Enabled = ((e.rowIndex Mod 2) = 0)

        If e.rowIndex Mod 17 = 0 Then
            e.itemObject.Item.RowHeader.Image.NETImageObject = imageListBitmaps.Images(e.rowIndex Mod 10)
        End If
        If e.rowIndex Mod 3 = 0 Then
            e.itemObject.Item.Cell(1).ForeColor = OLECvt.ToOleColor(System.Drawing.Color.Red)
            e.itemObject.Item.Cell(1).BackColor = OLECvt.ToOleColor(System.Drawing.Color.Aqua)
        End If

VB6

Private Sub SftTree1_VirtualItem(ByVal RowIndex As Long, ByVal ItemObject As VirtualItem)
    ItemObject.Item.Cell(0).Text = "Item " & RowIndex
    ItemObject.Item.Cell(1).Text = "Cell " & RowIndex
    ItemObject.Item.Cell(2).Text = "A"
    ItemObject.Item.Cell(3).Text = RowIndex Mod 7
    ItemObject.Item.Cell(4).Text = "Last " & RowIndex
    ItemObject.Item.RowHeader.Text = "R" & RowIndex
    ItemObject.Item.Enabled = ((RowIndex Mod 2) = 0)

    If RowIndex Mod 17 = 0 Then
        ItemObject.Item.RowHeader.Image.Picture = Image1(RowIndex Mod 10).Picture
    End If
    If RowIndex Mod 3 = 0 Then
        ItemObject.Item.Cell(1).ForeColor = vbRed
        ItemObject.Item.Cell(1).BackColor = vbWhite
    End If

C#

        private void axSftTree1_VirtualItem(object sender, AxSftTreeLib75._DSftTreeEvents_VirtualItemEvent e) {

            e.itemObject.Item.get_Cell(0).Text = "Item " + e.rowIndex;
            e.itemObject.Item.get_Cell(1).Text = "Cell " + e.rowIndex.ToString();
            e.itemObject.Item.get_Cell(2).Text = "A";
            e.itemObject.Item.get_Cell(3).Text = (e.rowIndex % 7).ToString();
            e.itemObject.Item.get_Cell(4).Text = "Last " + e.rowIndex.ToString();
            e.itemObject.Item.RowHeader.Text = "R" + e.rowIndex.ToString();
            e.itemObject.Item.Enabled = ((e.rowIndex % 2) == 0);

            if (e.rowIndex % 17 == 0)
                e.itemObject.Item.RowHeader.Image.NETImageObject = imageListBitmaps.Images[e.rowIndex % 10];
            if (e.rowIndex % 3 == 0) {
                e.itemObject.Item.get_Cell(1).ForeColor = OLECvt.ToOleColor(System.Drawing.Color.Red);
                e.itemObject.Item.get_Cell(1).BackColor = OLECvt.ToOleColor(System.Drawing.Color.Aqua);
            }

C++

    pItemObj->Item->Cell[3]->Text = (LPCTSTR) str;

    str.Format(_T("Last %ld"), RowIndex);
    pItemObj->Item->Cell[4]->Text = (LPCTSTR) str;

    str.Format(_T("R%ld"), RowIndex);
    pItemObj->Item->RowHeader->Text = (LPCTSTR) str;

    pItemObj->Item->Enabled = ((RowIndex % 2) == 0) ? VARIANT_TRUE : VARIANT_FALSE;

    if (RowIndex % 17 == 0)
        pItemObj->Item->RowHeader->Image->SetImageListH((OLE_HANDLE)(HIMAGELIST)m_Bitmaps, (short)(RowIndex % 10));
    if (RowIndex % 3 == 0) {
        pItemObj->Item->Cell[1]->ForeColor = RGB(255,0,0);
        pItemObj->Item->Cell[1]->BackColor = RGB(255,255,255);
    }

See Also SftTreeItem Object | Object Hierarchy


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