Get information on "Show scroll bars" on macOS

Is there a way to get information on the value of “Show scroll bars” for macOS?

I want to show a widget for scrolling like in the docs:

But I only need the widget when the user doesn’t show the scrollbars.

Maybe read the global prefs?
defaults read -g AppleShowScrollBars

The NSScroller class has a property for this and you can register for notifications if the customer changes their choice.

The code for this is part of the Ohanaware AppKit.

@Sam_Rowlands : How do I use NSScroller.scrollerStyleChangedHandler for a TextArea?

The event will tell you when the property changed.

So on first open of your control or window, you read that property and hide show your “return to top” button, you also do once this event fires.

The quickest way would be to add the NSScroller to your window, otherwise I’d recommend looking at the source code and just extracting the part for reading the property and capturing the notification.

Edit: I can make you an example in a couple of days. I got a bunch of things I need to do before hand, if you don’t mind waiting.

1 Like

Thanks! That would be great. It’s not urgent.

I sent you an e-mail this morning, containing a demo project which shows you how to read the scroller style, react to the style changes, react to the TextArea being scrolled and resized.

For others, I am sorry but I can’t share publicly share the code as it uses some exclusives to the Ohanaware App Kit.

I don’t understand. Why does the type of mouse the user has have anything to do with wether or not they should get a quick “jump to top” button? Just always show it or never show it. Everybody scrolls.

I see that not only @Beatrix_Willius , but others in other dev communities are also looking at ways of making “There’s more content” more obvious.

My understanding is that @Beatrix_Willius wants to display an indicator when the scrollbar is hidden (and there’s more content), helping the customer to understand that there’s more they can’t see. And by using “buttons” to skip pages, it not only makes it decorative, but also functional.

@Thom_McGrath : you scroll when you think that there is more content like for the Xojo website:

I have some intro window where I describe the features of my app. There is no indication at all that there could be more text:

Instead of the manual link being the last paragraph there are more links:

Of course, I could do a longer paragraph so that the text ends in the middle. But I have 3 versions of my app times 5 translations. So I thought that the up/down buttons might be a nice indicator that there is more to read.