Go to the FreeLists Home Page Home Signup Help Login
 



[haiku-development] || [Date Prev] [06-2007 Date Index] [Date Next] || [Thread Prev] [06-2007 Thread Index] [Thread Next]

[haiku-development] Re: BView.ScollBy and scrolling BViews in general

  • From: Chris Peel <chris.gsi@xxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 1 Jun 2007 22:38:53 +0100

On 1 Jun 2007, at 11:26, Axel Dörfler wrote:

Chris Peel <chris.gsi@xxxxxxxxxxxx> wrote:
I'd like to understand the mechanics a bit more as the documentation
talks about a Bounds rectangle (which I understand) but also a 'Data'
rectangle and I'm not sure where that fits in.  For example, if I
create a new BView with frame (10,10) (199,199) this will give me a
190x190 rectangle at point 10,10 in the parent (or BWindow)
coordinate space.  Now, if I do a BView.ScrollBy(20,0) this would
scroll the view content by 20 pixels so now I get:

Frame = 10,10 - 199, 199 (i.e. no change)
Bounds = 20,0 - 219,199?

So how would I draw more content into the view?

As you can see, I'm really confused by this so any information from
the devs would be greatly appreciated here!

In file:///boot/beos/documentation/Be Book/The Interface Kit/
1_Drawing.html (on your HD if you're in BeOS) there is a short section.
In the example above, the new bounds would be BRect(20, 0, 209, 189);
the bounds are always the relative size of the view. It's you who
define the data section of the view; if you draw something at x=190 it
wouldn't be seen before you scroll the view, but afterwards it is.
Since the scrollview has no idea about the size of your data rectangle,
you have to manually set the scrollbars to make them fit. See
BListView::_FixupScrollBar() in the Haiku implementation of the
BListView class to see how to do that.

HTH,

Bye,
   Axel.



Hi Axel

Yes, it does! Thanks for that, I was wondering how the scrollbars 'magically' updated their positions! I'll take a look at BListView too.









[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.