Home » U++ Library support » U++ Widgets - General questions or Mixed problems » What does ScrollBar::SetPage do?
What does ScrollBar::SetPage do? [message #13893] |
Thu, 31 January 2008 15:16 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi!
I'm trying to implement an optimized control which would allow the scrolling of virtually huge surfaces. This is why I just can't insert a control into a larger one with two scrollbars. I'm imlementing a "virtual" scroll mechanism.
I have two scrollbars (one vertical and one horizontal). I compute the difference between the dimensions of the control and the dimension of virtual area and set them to the maximum of each scrollbar with SetTotal. Then I'm trying to set a page size:
dx = ...
scrHor.SetTotal(dx);
scrHor.SetPage(dx / 10);
This works fine, but it seems that the last page is only scrolled to some fixed margin (somewhat like the IntegralHeight property in ColumnList). I can't get the last pixels of the area to show. But if I use SetPage(1), I can access all the ranges from the scrollbar, allowing full scrolling of the surface. But now scrolling is done in steps of 1, so clicking on the scrollbar body is useless (not useless, but very slow with increments of 1).
Am I misunderstanding the use of SetPage? How can I set a page dimension, which does not lead to some inaccessible values near the end?
|
|
|
Re: What does ScrollBar::SetPage do? [message #13895 is a reply to message #13893] |
Thu, 31 January 2008 16:26 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
The maximum position of a scrollbar (the value returned from ScrollBar::Get) is position - pagesize. For instance, for a scrollbar set as:
scroll.Set(1, 10, 99)
the maximum position will be 89, so that the last page will be displayed in full. Obviously setting pagesize to 1 will result in the maximum pos being 98.
try setting it like this:
total = virtual area size (not size - ctrl size)
pagesize = ctrl size
[Updated on: Thu, 31 January 2008 16:31] Report message to a moderator
|
|
|
|
|
|
Re: What does ScrollBar::SetPage do? [message #13941 is a reply to message #13937] |
Sat, 02 February 2008 09:01 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
cbpporter wrote on Fri, 01 February 2008 18:18 |
luzr wrote on Fri, 01 February 2008 23:37 |
Hm, maybe this explanation can be easily simplified by example:
For LineEdit, vertical pagesize is number of lines that fit into the current height of page, while total is number of lines in the document...
Mirek
|
Thanks. I think I'm already used with these semantics. Again, with no documentation, very hard to determine if something looks one way but actually behaves slightly different.
|
Ah, yes. Now I remember that ScrollBar was somewhat forgotten... Will try to fix this soon.
Quote: |
I know that just saying that there is little documentation is easy and I could do something about it, but unfortunately I'm far to busy coding.
|
Yep, that is the exact reason. Besides, coding is much more fun...
Quote: |
I guess this is the case for most of us. At least I've been working this week on a translation. Hope it's ready by next week.
|
Thanks!
Mirek
|
|
|
Goto Forum:
Current Time: Mon Jun 10 13:17:40 CEST 2024
Total time taken to generate the page: 0.01995 seconds
|