HeaderPane
Main
Hide
Share Link
Print

EditAllowed Event, SftTree Class

Occurs to determine whether a cell can be reached for cell editing.

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

Syntax

public event EditAllowedEventHandler EditAllowed;
Public Event EditAllowed As EditAllowedEventHandler

Comments

Occurs to determine whether a cell can be reached for cell editing.

This event occurs when cell editing is started using the CellClass.Edit method or while an SftTree.EditNavigate method is processed, to determine whether a cell can be reached during cell editing. It is possible to suppress cell editing for items and cells using the ItemClass.EditIgnore and CellClass.EditIgnore properties. In addition, the EditAllowed event can be used to disallow editing of cells, even if the cell is otherwise editable.

If cell editing is suppressed for items and cells using the ItemClass.EditIgnore and CellClass.EditIgnore properties, the EditAllowed event does not occur for these items and cells.

Other than determining whether a cell can be reached during cell editing, this event should not take any other action or update the tree control in any way.

Examples

C#

        private void sftTree1_DragOver(object sender, DragEventArgs e) {
            DumpValues("DragOver", e);

            e.Effect = DragDropEffects.Copy; // accept anything
        }

        private void sftTree1_EditAllowed(object sender, Softelvdm.SftTreeNET.EditAllowedEventArgs e) {
            DumpValues("EditAllowed", e);

            e.Allowed = (e.Cell.ColumnIndex == 2); // only edit cells in column 2
        }

        private void sftTree1_EditClickOutside(object sender, Softelvdm.SftTreeNET.EditClickOutsideEventArgs e) {
            DumpValues("EditClickOutside", e);
        }

VB.NET

End Sub

Private Sub SftTree1_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles SftTree1.DragOver
    DumpValues("DragOver", e)

    e.Effect = DragDropEffects.Copy ' accept anything
End Sub

Private Sub SftTree1_EditAllowed(ByVal sender As System.Object, ByVal e As Softelvdm.SftTreeNET.EditAllowedEventArgs) Handles SftTree1.EditAllowed
    DumpValues("EditAllowed", e)

    If e.Cell.ColumnIndex = 2 Then ' only edit cells in column 2
        e.Allowed = True
    Else
        e.Allowed = False
    End If

See Also SftTree Class | Classes | SftTree/NET 3.0