Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

FocusObject Property, SftTree Class

Defines the object (item or cell) that is the focus object.

Class: SftTree
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public object FocusObject { get; set; }
Public Property FocusObject As Object

Value

The focus object or null/Nothing if there is no focus object.

The default value is null/Nothing.

Comments

Defines the object (item or cell) that is the focus object.

The current item or cell is the item or cell that has the focus rectangle. The focus object is rendered with a focus rectangle based on the SftTree.ShowFocusRectangle property.

The focus rectangle is controlled using the SftTree.ShowFocusRectangle property. The size of the focus rectangle is consistent with the current selection style (SftTree.SelectionStyle).

The focus item or cell is not necessarily also selected (ItemClass.Selected or CellClass.Selected).

When the user changes the current item or cell, the FocusObjectChange event occurs. The SelectionChange event occurs when the selection changes.

If item selection is active, the focus object is an item (ItemClass), otherwise cell selection is active and the focus object is a cell (CellClass).

The SftTree.FocusItem and SftTree.FocusCell properties also define the focus object and are identical to the FocusObject property but accept an item (ItemClass) or a cell (CellClass) instead of the more generic object class.

Examples

C#

                        item.Expand(ExpandStyleEnum.DirectOnly);
                    } else
                        newItem = sftTree1.ItemCollection.Add(s);
                }
            }
            sftTree1.Columns.MakeOptimal(0, false);
            sftTree1.RecalcHorizontalExtent();
            newItem.ScrollIntoView();
            sftTree1.FocusObject = newItem;
            newItem.Selected = true;
            sftTree1.Initializing = false;
        }

        // This is a small helper routine to show all properties and fields of an object
        private void DumpValues(object o) {
            PropertyInfo[] api = o.GetType().GetProperties();

VB.NET

            Else
                newItem = sftTree1.ItemCollection.Add(s)
            End If
        Next
    End If
    sftTree1.Columns.MakeOptimal(0, False)
    sftTree1.RecalcHorizontalExtent()
    newItem.ScrollIntoView()
    sftTree1.FocusObject = newItem
    newItem.Selected = True
    sftTree1.Initializing = False
End Sub

' This is a small helper routine to show all properties and fields of an object
Private Sub DumpValues(ByVal o As Object)
    Dim api() As PropertyInfo = o.GetType().GetProperties()

See Also SftTree Class | Classes | SftTree/NET 2.0



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.