# ScrollBar::setAutoHide() trouble

**URL:** <https://forum.juce.com/t/scrollbar-setautohide-trouble/5114>\
**Category:** General JUCE discussion\
**Created:** [April 3, 2010, 10:42am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114 "2010-04-03T10:42:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hladik](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hladik](https://forum.juce.com/u/hladik)\
**Post date:** [April 3, 2010, 10:42am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/1 "2010-04-03T10:42:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 11, 2010, 10:38am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/2 "2010-04-11T10:38:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hladik](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hladik](https://forum.juce.com/u/hladik)\
**Post date:** [April 23, 2010, 6:11pm UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/3 "2010-04-23T18:11:02Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 23, 2010, 7:43pm UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/4 "2010-04-23T19:43:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hladik](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hladik](https://forum.juce.com/u/hladik)\
**Post date:** [April 24, 2010, 7:15am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/5 "2010-04-24T07:15:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 24, 2010, 9:26am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/6 "2010-04-24T09:26:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hladik](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hladik](https://forum.juce.com/u/hladik)\
**Post date:** [April 24, 2010, 2:50pm UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/7 "2010-04-24T14:50:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 25, 2010, 9:48am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/8 "2010-04-25T09:48:23Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![hladik](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hladik](https://forum.juce.com/u/hladik)\
**Post date:** [April 25, 2010, 11:21am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/9 "2010-04-25T11:21:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 25, 2010, 2:18pm UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/10 "2010-04-25T14:18:43Z")

</div>

I’ll have a look.

---

<div class="post-metadata">

**Author:** ![friscokid](https://avatars.discourse-cdn.com/v4/letter/f/d9b06d/32.png) [@friscokid](https://forum.juce.com/u/friscokid)\
**Post date:** [June 6, 2010, 10:58am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/11 "2010-06-06T10:58:29Z")

</div>

I have the same problem with the current tip:

```auto

```

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

---

<div class="post-metadata">

**Author:** ![masshacker](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/masshacker/32/650_2.png) [@masshacker](https://forum.juce.com/u/masshacker)\
**Post date:** [June 6, 2010, 11:23am UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/12 "2010-06-06T11:23:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 6, 2010, 12:52pm UTC](https://forum.juce.com/t/scrollbar-setautohide-trouble/5114/13 "2010-06-06T12:52:00Z")

</div>

Ok, that should all be sorted out now.
