Keeping Listbox scrollbars hidden

Hello,
when in System Preferences > General “Show scroll bars” is set to “Automatically based on mouse…”, or to “When scrolling”, the Finder and all Apple apps never show the vertical or horizontal scrollbars, even if a small listbox has got a high number of rows. Scrollbars show up only when scrolling, then they fade away.
In Xojo, with autoHideScrollbars = true, in the same circumstances, scrollbars are always visible.
I tried using a timer that in the mouseWheel action-event sets scrollbarVertical to false, but results are very poor.
Is there any trick to mimic apple’s behavior? Or is Xojo going to implement such behavior?
Thanks.

you can try this ListBox OverlayScrollbars by Massimo Valle

I have been using Massimo’s OverlayScrollbars, but it seems that with the advent of El Capitan something is going out of control. For instance, Horizontal scrollbars don’t show up.

Documentation for ListBox.AutoHideScrollBars
It’s a property for managing the scroll bar vs. the item count in the ListBox.
It does not relate to the System Preferences setting about scrollbar visibility.

Tim,
per se I’m not complaining against ListBox.AutoHideScrollBars’ behavior, since it works as for docs. Yet I would like to see ListBoxes implementing the Apple’s behavior, since meantime users have got accostumed at not seeing the scrollbars: i.e. the so called user-experience. May be a feature request?

Set the ListBox with ScrollBarVertical false (off in the IDE)

Add a Timer with a period of 1000 and modeOff to the window

In its Action event :

ListBox1.ScrollBarVertical = False

In the ListBox MouseWheel event :

[code]Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean
me.ScrollBarVertical = True

Timer1.mode= Timer.ModeOff
Timer1.mode= Timer.ModeSingle
End Function
[/code]

This will be very close to the way it works in TextEdit etc. The scrollbar will appear when the mouse wheel is run or Magic Mouse scroll gesture. Then after a second it will go away.

Yep, it is what I did in my test project. But coming also from you, I feel more confident. Thank you Michel.
Now I’ll expand it for all listboxes and have it work only when System Preferences are not set tho “Always”.

Thanks for the the tips all - been looking for something like this and it does work, but it causes a hiccup - when the the vertical scrollbar is hidden, it leaves a new column the same width as the scrollbar.
This can be hidden by setting the listbox.columncount to it’s original value in the timer action, but seems weird…

Is this expected behaviour?

before scrolling:

after scrolling:

Try adding a

ListBox1.Invalidate

at the end of the timer’s action event. Maybe that’ll help.

Thanks @Dale Arends - visually it’s exactly the same as setting listbox.columnCount to it’s initial value… i’ll just run with it for now