{
Items, Delete example
The following cross-platform example deletes an item in the tree view when the user clicks on it if a checkbox is checked. 
} 
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  HT : THitTests;
begin
if (CheckBox1.Checked) and (Sender is TTreeView) then
  begin
  with Sender as TTreeView do 
    begin
    HT := GetHitTestInfoAt(X,Y);
    if (htOnItem in HT) then
      Items.Delete(GetNodeAt(X,Y));
    end;
  end;
end; 
