Is it possible to get OS X scrollbars on a ListBox

[quote=198687:@Christoph De Vocht]Here is little project that includes native OSX scrollbars to a listbox with several declares. They are working natively so they are transparent, fade out, fade in, …

http://www.filedropper.com/nativeosxscrollerlistbox[/quote]

This is not transparent as it is elsewhere in OS X, would that be simply a browser showing this page. Your project, like Massimo’s, shows a grey scrollbar. Is is cute, but IMHO not conformant to OS X native scrollbar. In fact, it resembles very much Massimo’s project with the modifications I posted.

It is transparent when using OSX10.9 or higher. :slight_smile: And it is a native scrollbar (check out the declares - no MBS plugins needed).
The scrollbar also widens up when clicking with when running OSX10.9 - OSX10.10 does not have this behaviour.

Changed the project so the transparency is clearly shown. :slight_smile:

http://www.filedropper.com/nativeosxscrollerlistbox_1

Thats not a screenshot op my project. :slight_smile:

This is a screenshot taking with OSX10.10.4

Did you set ‘Show scroll bars’ to ‘Always’ in the preferences?

[quote=198698:@Christoph De Vocht]Thats not a screenshot op my project. :slight_smile:

This is a screenshot taking with OSX10.10.4

[/quote]

Fair enough. But it does use NSViewMBS ; I do not have it in my plugin folder, and it simply won’t compile…

Oeps… didn’t saw that. I don’t think it is needed. Will see if I can do it without MBS plugins. :slight_smile:

you can comment the lines scrollercanvas1.NSViewMBS.alphaValue… , but then it does not fade out.

Here it is without MBS plugins. This version does lack the fade-in and fade-out feature. Maybe it is possible to add with some declare but here it is for now:

http://www.filedropper.com/nativeosxscrollerlistboxwithoutfade

You beat me at the clock. :slight_smile:

The fade out should be manageable by changing the colors in a timer and adding Alpha.

At any rate, even with a simple Canvas.Visible = False it is very close to the native Yosemite ScrollBar.

that seems to work (TimerFader.Action)

if fadevalue > 0 then fadevalue=fadevalue-20 scrollercanvas1.Visible = true else fadevalue=0 scrollercanvas1.Visible = False me.mode=0 end if

The code is still a bit messy but it does work fine. I use this in all my project that do use the listbox. No ugly non-native scrollbars for me. :slight_smile: I still think Xojo Inc should add this by default.

Indeed. But there is no feature request I could find yet.

Both of these examples are great! Thanks for sharing.

With the ListBox OverlayScrollbars by Massimo Valle I found two issues @Massimo Valle

First is with scrolling, the pointer loses the scroll knob. I was not able to fix it. You can see this as you scroll the knob up and down as shown in this video;
https://drive.google.com/file/d/0B3tUjVnP-jJIVkVLWnNHRVBUZjg/view?usp=sharing

Secondly, should the AddHandler methods not have a corresponding RemoveHandler?

I did a quick adaptation of my XDC NSScrollView example to control a Listbox instead of a container control.

It’s about as close to native look and feel as you’ll get with the Listbox. Keep in mind that the Listbox does all vertical scrolling by rows, not pixels, so there won’t be a smooth scroll up and down.

ListboxNSScroll.xojo_binary_project

You’ll probably want to disable elastic scrolling (declares required) or there seem to be some artifacts left in the heading…