I'm currently doing the following:
As you can see, the height of the scroll view is the same as the view rect. In my mind, this should not generate a vertical scroll bar. However, because the horizontal scroll bar is generated (it takes up vertical space), it then results in the vertical scroll bar appearing. Hence, I need a way to get the height of the horizontal scroll bar so I can add it onto the height of the scroll view to compensate. In Windows lingo, this would be the same as setting the "client rect" size of the scroll view. Is there any way of doing this?
asked Apr 06 '10 at 07:04 PM
I encountered exactly this issue, and I kind of agree with Cyclops (hard-coding values is not great but in this case I would), though I would make a public member variable so the designer can tweak those Rects and the spacing later if the skin/style changes.
Also you can get the height of the Horizontal Scroll Bar style (e.g. skin.GetStyle("horizontalscrollbar").fixedHeight), though with padding/margins that could probably be changed.
answered Apr 12 '10 at 08:44 PM
I think the viewRect is basically a "client rect". Personally, I would just subtract 20 from the viewRect height, and call it a day :) I realize hard-coding numbers is frowned upon, but how many times is a scrollbar's dimensions likely to change? (Okay, maybe 20 isn't right, play around with it).
answered Apr 06 '10 at 07:33 PM