[lazarus] Treeview scrollbars

Micha Nelissen micha at neli.hopto.org
Sun Dec 21 08:59:29 EST 2003


Hi,

On win32 treeviews always schow scrollbars, which is quite annoying 
because they are not always necessary. I think I have found the problem: 
the SCROLLINFO record passed when calling SetScrollInfo has the 
following property:

---
The SetScrollInfo function performs range checking on the values 
specified by the nPage and nPos members of the SCROLLINFO structure. The 
nPage member must specify a value from 0 to nMax - nMin +1. The nPos 
member must specify a value between nMin and nMax - max(nPage  - 1, 0). 
If either value is beyond its range, the function sets it to a value 
that is just within the range.
---

The lcl always passes nPage <= nMax, because GetMaxScrollLeft always 
returns a value >= 0 and nMax is:

ScrollInfo.nMax := Max(1,GetMaxScrollLeft+integer(ScrollInfo.nPage));

But only when setting nPage > nMax ( == nPage = nMax+1 ) the scrollbar 
will disappear. I have tried some fiddling around, but it didn't work as 
I wanted, and I am not familiar with the code at all. Can someone make a 
suggestion?

Thanks,

Micha.






More information about the Lazarus mailing list