Sign in Join
FPDoc Onlineexperiment

TCustomTreeView.EditorKeyDown procedure

Member of TCustomTreeViewprotectedIn unit ComCtrls

Implements the OnKeyDown event handler for the editor on the tree view control.

Declaration

pascal
procedure EditorKeyDown(Sender: TObject; var Key: Word; 
 Shift: TShiftState); virtual

Description

EditorKeyDown ensures that key down events and focus change are handled for the tree node editor on the control.

Key and Shift contain the virtual key code and shift modifier(s) for the key down event. Virtual key codes handled in the method include:

Return (VK_RETURN)
Ends editing and accepts the changed valued in the Text for the tree node in EditingItem.
Escape (VK_ESCAPE)
Ends editing but rejects any change to the text for the EditingItem.

Shift must be an empty set ([]) to handle these virtual key codes in the method.

EditorKeyDown calls EndEditing to update state flags, and to signal assigned OnEdited and OnEditingEnd events handlers when the Text for the tree node is changed. It calls SetFocus to restore focus to the tree view control if the tree node editor was assigned and had focus on entry to the method.

The value in Key is set to 0 to if the virtual key code is handled in the method.

EditorKeyDown is used as the OnKeyDown event handler for the internal TEdit control created in the BeginEditing method.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.