Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-12

Treeview scrollbars

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to Micha Nelissen: On win32 treeviews always schow scrollbars, which is quite annoying because they are not…
Show quoted text 25 lines
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 someone make a suggestion?

Not really a suggestion:
I implemented ssAutoHorizontal, ssAutoVertical, ssAutoBoth for TTreeView.

Mattias

Reply by email

Micha Nelissen

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 someone make a suggestion?

Thanks,

Micha.

Reply by email