IVTEditLink.EndEdit Method

Virtual Tree View

This function will be called by the virtual tree when the current editing is being finished.

Pascal
function EndEdit: 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 finished. Return false if the node editor is in an internal state which does not allow to finish the editing right now - possibly because there is no valid value available at the moment. If the editing can be finished transmit the edited value to the tree or to the data structure which is displayed in the tree. 

 

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, EndEdit 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.EndEdit: Boolean;
begin
  Result := not FStopping;
  if Result then
  try
    FStopping := True;
    if FEdit.Modified then
      FTree.DoNewText(FNode, FColumn, FEdit.Caption);
    FEdit.Hide;
  except
    FStopping := False;
    raise;
  end;
end;

Interface
Links
What do you think about this topic? Send feedback!