check if a TreeView is fully expanded or collapsed

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
check if a TreeView is fully expanded or collapsed?
function IsTreeviewFullyExpanded(tv: TTreeview): Boolean;
var
Node: TTreeNode;
begin
Assert(Assigned(tv));
if tv.Items.Count > 0 then
begin
Node := tv.Items[0];
Result := True;
while Result and Assigned(Node) do
begin
Result := Node.Expanded or not Node.HasChildren;
Node := Node.GetNext;
end; {While}
end {If}
else
Result := False
end;
function IsTreeviewFullyCollapsed(tv: TTreeview): Boolean;
var
Node: TTreeNode;
begin
Assert(Assigned(tv));
if tv.Items.Count > 0 then
begin
Node := tv.Items[0];
Result := True;
while Result and Assigned(Node) do
begin
Result := not (Node.Expanded and Node.HasChildren);
Node := Node.GetNext;
end; {While}
end {If}
else
Result := False
end;
 
后退
顶部