From c601ece40c91b0a576b18da282db18d9390c38fe Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 9 Apr 2009 22:22:38 +0000 Subject: [PATCH] Work around wrongly calculated scrollbar range in host lists. Ignores hidden (= filtered) nodes now. --- source/main.pas | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/main.pas b/source/main.pas index 53c6c9e5..287ab566 100644 --- a/source/main.pas +++ b/source/main.pas @@ -7037,9 +7037,18 @@ begin end else lblFilterVTInfo.Caption := ''; - // Needs a refresh to apply visible states - VT.Refresh; - VT.UpdateScrollBars(True); + // RootNode.TotalHeight needs to be recalculated so the scrollbar has the correct + // range, ignoring hidden nodes. + // Similar to what is done by VT.FixupTotalHeight() which doesn't work + // for some reason if called from within VT.UpdateVerticalScrollBar() + VT.RootNode.TotalHeight := 0; + Node := VT.GetFirst; + while Assigned(Node) do begin + if vsVisible in Node.States then + Inc(VT.RootNode.TotalHeight, Node.TotalHeight); + Node := Node.NextSibling; + end; + VT.UpdateVerticalScrollBar(True); end;