IVTEditLink.CancelEdit Method

Virtual Tree View

This function will be called by the virtual tree when the current editing is about to be cancelled.

Pascal
function CancelEdit: Boolean; stdcall;
Description

Hide the node editor here. This might be something like Visible := False or Hide. The return value should be True if the editing can be cancelled. Return false if the node editor is in an internal state which does not allow to cancel the editing right now. 

 

Do not destroy the node editor instance because this will be done implicitly via reference counting.

Notes

If the edited tree is changed during this function, i.e. focus change, node deletion and so on, CancelEdit might be 

called again by the tree which can lead to access violations. It is therefore advisable to block reentrancy with a 

boolean variable. Example: 

 

function TStringEditLink.CancelEdit: Boolean;
begin
  Result := not FStopping;
  if Result then
  begin
    FStopping := True;
    FEdit.Hide;
    FTree.CancelEditNode;
  end;
end;
Interface
Links
What do you think about this topic? Send feedback!