GetPrevChild (Delphi)
Description
The following code tests whether the currently selected item has a sibling; if so, HasSibling is set to True.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
HasSibling: Boolean;
SelNode: TTreeNode;
ParentNode: TTreeNode;
begin
SelNode := TreeView1.Selected;
ParentNode := SelNode.Parent;
HasSibling := (ParentNode.GetPrevChild(SelNode) <> nil) or
(ParentNode.GetNextChild(SelNode) <> nil);
if (HasSibling) then Edit1.Text := 'True'
else Edit1.Text := 'False';
end;
Uses
- Vcl.ComCtrls.TTreeNode.Parent ( fr | de | ja )
- Vcl.ComCtrls.TTreeNode.GetNextChild ( fr | de | ja )
- Vcl.ComCtrls.TTreeNode.GetPrevChild ( fr | de | ja )