[haiku-3rdparty-dev] Re: Attaching a BScrollBar to a BListView

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Sun, 29 Nov 2009 17:50:18 +0100

Hi,

Von: "Yashasvi A.C." <yashasviac@xxxxxxxxx>
> On Sun, Nov 29, 2009 at 11:09 PM, Stephan Assmus <superstippi@xxxxxx>
> wrote:
> > You cannot add a ScrollBar to the view that the scrollbar is supposed to
> > scroll. Just think about it! :-)
> 
> Why not? If I want the scroll bar to appear in just a list, shouldn't it
> be added to that?

When you scroll a view, all the content of that view is scrolled, including 
children views. If you add the scroll bar to the list view, and then want to 
scroll the list view with the scroll bar that is inside the list view, how is 
that supposed to work? The scrollbar will be moved/scrolled away under your 
mouse!

Scrollbars are always sibling views of the views they scroll. Normally, you put 
a list view into a BScroll*View*. The BScrollView is configured however you 
want, like to show only a vertical scrollbar. It will take care of all the 
layout.

If you follow the BeBook link on your Desktop and look up BListView in the 
Interface Kit, I am almost 100% sure there is example code for how to embed the 
listview into a BScrollView. If you want to know how to do the equivalent code 
for the new layout API, please just look into the code of one of Haiku's 
preflets. I already pointed you at Sounds.

> Also, how do I use the Tracker add-on? I only just recently found out the
> grok page where I can type in some function name and I can see code where
> it
> has been used. :( Guess I need a bit of time getting used to this.

Right-click into a folder, for example src/preferences and pick "Text Search" 
from the Add-ons menu in the context menu. Then type BListView into the text 
field. Just double click an entry in the resulting list and it will open in Pe.

Best regards,
-Stephan

Other related posts: