2006. augusztus 31., csütörtök
Check if a TTreeView is fully expanded or collapsed
Problem/Question/Abstract:
How to check if a TTreeView is fully expanded or collapsed
Answer:
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;
end
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;
end
else
Result := false
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése