Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

EditSetup Event, SftTree Class

Occurs when a cell is about to be edited and a control must be positioned over the cell for editing purposes.

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

Syntax

public event EditSetupEventHandler EditSetup;
Public Event EditSetup As EditSetupEventHandler

Comments

Occurs when a cell is about to be edited and a control must be positioned over the cell for editing purposes.

This event makes a control available for cell editing. The control's display attributes and contents must be fully initialized by this event and additional final customizations can be performed. For example, when a combo box is used, this event can drop down the dropdown portion of the combo box control.

Once the control is positioned, visible and enabled and the EditSetup event ends, cell editing has started. The control's event handlers such as KeyDown and KeyPress can be used to implement cell navigation using the EditNavigate method.

The EditSetup event should not be used to otherwise manipulate or update the tree control in any way.

Examples

C#

        private void sftTree1_EditAllowed(object sender, Softelvdm.SftTreeNET.EditAllowedEventArgs e) {
            Debug.Write("** EditAllowed");
            DumpValues(e);
            if (e.Cell.ColumnIndex == 0) // Can't edit the first column
                e.Allowed = false;
        }

        private void sftTree1_EditSetup(object sender, Softelvdm.SftTreeNET.EditSetupEventArgs e) {
            Debug.Write("** EditSetup");
            DumpValues(e);

            if (e.Cell.ColumnIndex == 1) {
                // We use a textbox for column 1 (remember, column 0 is not editable,
                // because of the EditAllowed event
                // set all textbox properties
                textBox1.Parent = sftTree1;     // make the tree control the parent window

VB.NET

Private Sub sftTree1_EditAllowed(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.EditAllowedEventArgs) Handles sftTree1.EditAllowed
    Debug.Write("** EditAllowed")
    DumpValues(e)
    If e.Cell.ColumnIndex = 0 Then ' Can't edit the first column
        e.Allowed = False
    End If
End Sub

Private Sub sftTree1_EditSetup(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.EditSetupEventArgs) Handles sftTree1.EditSetup
    Debug.Write("** EditSetup")
    DumpValues(e)

    If e.Cell.ColumnIndex = 1 Then
        ' We use a textbox for column 1 (remember, column 0 is not editable,
        ' because of the EditAllowed event
        ' set all textbox properties

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.