Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
cbpporter is currently offline  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 Go to previous messageGo to next message
mrjt is currently offline  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 #13896 is a reply to message #13895] Thu, 31 January 2008 16:51 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
mrjt wrote on Thu, 31 January 2008 17:26

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


Thank you for the help! That worked great. I'm used to slightly different semantics when setting up the parameters for scrollbars, but I guess this is just as good, if not better.
Re: What does ScrollBar::SetPage do? [message #13929 is a reply to message #13895] Fri, 01 February 2008 22:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Thu, 31 January 2008 10:26

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



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
Re: What does ScrollBar::SetPage do? [message #13937 is a reply to message #13929] Sat, 02 February 2008 00:18 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
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. 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. 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.
Re: What does ScrollBar::SetPage do? [message #13941 is a reply to message #13937] Sat, 02 February 2008 09:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
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... Smile 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
Previous Topic: Frames dissapearing and Buttons not drawing
Next Topic: cannot open menu by key?
Goto Forum:
  


Current Time: Thu Mar 28 09:30:11 CET 2024

Total time taken to generate the page: 0.01726 seconds