It's easy to check that node is visible. But I don't know how to rightly define that node is presented on screen. I can find out only so:
BottomNode := Tree.BottomNode;
Node := Tree.TopNode;
IdBottomNode := Tree.AbsoluteIndex(BottomNode);
while Tree.AbsoluteIndex(Node) <> IdBottomNode do
begin
Node := Node.NextSibling;
if not Assigned(Node) then
Break;
end;
(code without checking)
But I think it is rather rough way. May be is there more accurate way?
You may write a function like follows. The Tree
parameter there specifies the virtual tree, the Node
is the node for which you want to check if it's visible, and the Column
optional parameter is the index of a column if you would need to determine whether the node and even column is visible in client rect:
function IsNodeVisibleInClientRect(Tree: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex = NoColumn): Boolean;
begin
Result := Tree.IsVisible[Node] and
Tree.GetDisplayRect(Node, Column, False).IntersectsWith(Tree.ClientRect);
end;
But maybe there's a more straightforward way...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With