I'm having trouble with the max position of a horizontal scrollbar. I'm creating a grid and need to set the .page and .max parameters dynamically
because user could resize the columns (each column can be resized). And I also don't want scrollbars to show up if scrolling is not necessary.
background:
Each column can be a different size, I'm using pixels as the horizontal currency.
Initially (for this example) I have columns of 103, 280, 360 pixels = 743 total pixels.
The page size is the client area's pixels (rcClient.Width() = 431).
When I set the max size(743) and page size(431), I do not have enough scroll room to scroll to the last column.
Just not understanding how to go about this. I understand the concept that page size (431) should be subtracted from the 743 as those
are pixels I'll not need to scroll to as they are already on my screen.
When I'm scrolling and reach 104, the 2nd column is left-most, when I reach 384 (103 + 280 + 1) then the 3rd column is left-most...but I don't have
room to get to 384 because 743 - 431 = 312 and the scrollbar is at the end.
When I resize the columns so they just fit inside the client area, the scrollbars disappear as they should.
If I mess with the .page and .max relationship then
scrollbars appear when there is no need to scroll.
I also don't understand why if nPage <= nMax a scrollbar appears.
It should be if nPage < nMax a scrollbar appears. You can test this for yourself.
Frustrated.
Help please!