ScrollBar::setAutoHide() trouble


#1

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.


#2

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


#3

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;

setModel(this);

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

getViewport()->setSingleStepSizes(0, ROW_HEIGHT);
getViewport()->setScrollBarsShown(true, false);
getViewport()->setScrollBarThickness(SCROLLBAR_THICKNESS);
getViewport()->setScrollBarButtonVisibility(false);
getViewport()->getVerticalScrollBar()->setAutoHide(false);
}[/code]


#4

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?


#5

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


#6

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


#7

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).


#8

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…


#9

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?


#10

I’ll have a look.


#11

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.
Thanks


#12

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).


#13

Ok, that should all be sorted out now.