[haiku-3rdparty-dev] Re: BOutlineListView with horizontal scrollbar
- From: "Mark Hellegers" <mark@xxxxxxxxxxxx>
- To: haiku-3rdparty-dev@xxxxxxxxxxxxx
- Date: Sat, 05 Mar 2016 17:54:21 +0100 CET
Hello all,
I am writing an application that has a BOutlineListView inside a
BScrollView. The vertical scrollbar of the BScrollView is nicely
updated depending on the height of the BOutlineListView, but the
horizontal scrollbar is not.
The only place where I can see where to set the proportion of the
horizontal scrollbar is in the Draw function of BOutlineListView, by
checking the width of the preferred size of the view against the
current width of the view (through the Bounds() function).
Is this the best option or is there a better idea than doing it like
this? It seems a bit wasteful to check it every Draw call.
I assumed there was no better way to do it and went ahead with doing it
in the Draw call.
In case anyone else would like to have a updated horizontal scrollbar
in their own code, the result can be seen at:
https://sourceforge.net/p/themis/code/HEAD/tree/trunk/themis/common/TOutlineListView.cpp
https://sourceforge.net/p/themis/code/HEAD/tree/trunk/themis/common/TOutlineListView.hpp
The code is MIT licensed, so feel free to do whatever you want with it.
It also overrides GetPreferredSize for BeOS as BeOS does not calculate
the preferred width correctly, while Haiku does.
I'm still all ears if someone has a better idea how to handle this than
fixing the scrollbar every Draw call.
Kind regards,
Mark
--
Spangalese for beginners
`Geh nae?'
`Do you know the serial number on the bumper of that 1958 Thunderbird?'
Other related posts: