[haiku-3rdparty-dev] Automatic hiding of scrollbars

  • From: Andrew Wood <andrew@xxxxxxxxxxxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Mon, 12 Aug 2013 21:19:46 +0100

Im trying to work out a way of automatically hiding a BScrollBar when its not needed. For example Im typing this in Thunderbird on Linux and this window has no scrollbars drawn as the text fits in it easily. On Haiku they would be drawn, but greyed out.


There doesnt seem to be any facility in the API to do this directly so Ive tried subclassing BScrollBar and tried out several things but have now confused myself totally!

Im thinking that its just a case of calling Hide() on the BScrollBar and resizing the target to fill the space previously taken up by the bar, and vice versa when the bar needs to be shown.

AM I right in thinking the SetRange() method will be called with arguments of 0.0 and 0.0 when the bar is not needed?

How does a target determine the size of its contents, which is not the same thing as the size of the BView itself? I'd like if possible to make my code as generic as possible, hopefully so it can be used by others, hence Im trying to make it work with a generic BView as a target.

Thanks
Andrew



Other related posts: