ScrollBar::setAutoHide() trouble


It seems that setAutoHide(false) no longer work, the scrollbar is displayed only when needed, just like when you specify “true”.

Furthermore, the width passed to the method ListBoxModel: paintListBoxItem() seems to reflect the presence of the invisible scrollbar, but sometimes, when the list is initialized, a full width (including the scrollbar width) is passed.


…nope - it seems to work just fine as far as I can tell (?)


I checked several times and indeed, at least on Windows with VC 7, the problem exists.
I tried to trace the JUCE code, but without success. Could you suggest how I could try to identify the problem or provide you with the best information to trace the cause?

My initialization code is as follows:[code]PatchesList::PatchesList()
: ListBox(T(“PatchesList”), NULL)
s_Instance = this;


setColour(ListBox::backgroundColourId, Colours::black);

getViewport()->setSingleStepSizes(0, ROW_HEIGHT);
getViewport()->setScrollBarsShown(true, false);


auto-hide certainly does work, otherwise every TextEditor and Viewport would have scrollbars all over the place.

Not sure what to suggest, but presumably it’s not hiding because your total range isn’t smaller than your visible range… Perhaps just a numerical error somewhere?


I see that there was a misunderstanding.
Always show a scrollbar is exactly what I would like to do!


Ok… but that also seems to work fine as far as I can see…


I don’t know exactly what this piece of code is doing, but if you comment line #187 of juce_Viewport.cpp:verticalScrollBar->setVisible (false); you obtain the expected behaviour using both setAutoHide(false) and setAutoHide(true).


Ah, I thought you were just talking about scrollbars, not the Viewport class. The viewport handles it differently, and takes control of auto-hiding - not sure if it’s capable of having always-visible scrollbars…


It looks like the Viewport class were able to manage this, at least until the beginning of January 2010. Couldn’t you investigate some more, please?


I’ll have a look.


I have the same problem with the current tip:

This used to set the ScrollBar of a ViewPort to be always visible, which is what you expect when calling setAutoHide(false).
Unfortunately this is broken now and does not have any effect anymore.

Could you please reimplement the old functionality.


Oh yes.
And I noticed that calling autoScroll in a viewport while its scrollbars are not visible
doesn’t affect the viewport (it does no autoscrolling).


Ok, that should all be sorted out now.