procedure TFormCustomerPage.cxTreeView1Expanded(Sender: TObject; Node: TTreeNode); var ANode: TTreeNode; begin inherited; ANode := Node.Parent; if ANode = nil then ANode := TTreeView(Sender).Items[0]; if ANode <> nil then begin TTreeView(Sender).Items.BeginUpdate; try if ANode = Node.Parent then ANode := ANode.getFirstChild; while ANode <> nil do begin if ANode <> Node then ANode.Collapse(True); ANode := ANode.getNextSibling; end; finally TTreeView(Sender).Items.EndUpdate; end; end; end;