Scrollbars on macOS always have a border. How to remove it or make the complete bar transparent? (without MBS, please)
What version of macOS are you using?
The scrollbars I see have no border… there are declares that can make them transparent… but not sure off the top of my head what they are.
I’m using Mojave and Xojo 2018r2
post a screen shot of what your scrollbar looks like… for me they have not changed appearance for quite a few macOS releases
How scrollbars look like in macOS; embedded into another control. That’s what I need.
How single scrollbars in Xojo look like; with background/border
I fail to see a border in the lower picture… and the border to the right in the upper picture is the listbox, not the scrollbar…
So. please explain what the issue you are facing is?
seems you mean BACKGROUND, and NOT border… totally different things.
Please find the very recent topic discussing this exact issue
Yes, it’s the background, sorry. It looked like it was just a border around the scroll bar
But you’re right. I have to remove the hole background to make it transparent so only the slider itself is visible.
This seems to be impossible (if you want to match macOS completely) without a fully declared NSScroller as a custom control or plugin. NSScroller has a ScrollerStyle property containing the values Legacy and Overlay. Overlay is what you are looking for, Legacy is the default style of a Xojo ScrollBar. Sadly, changing it via declare does not change the ScrollBar and the property reverts to Legacy.
This is possibly caused by the class PreferredScrollerStyle overriding the custom choice.
I do not know if there are technical reasons for this limitation, but as overlay scrollers exist since macOS 10.7 and Xojo does not support this system anymore, maybe this could be changed easily today now Does anyone know if a feature request for this exists in Feedback? I rarely am lucky finding things there
Legacy is the macOS default actually… and Overlay reduces the background alpha to around 50%
But no matter what style you choose in system settings, a Xojo ScrollBar will always stay in Legacy mode.
Anyway, I found this old but still working NSScrollView example by Jim. Its not a native NSScroller but a NSScrollView containing automatic scrollers. Not exactly what was being asked for but a good solution in many cases.
To correct my errors: Dave is right. What Overlay changes is basically a bit of cosmetics and the ability to make the “knob” the filled portion only appear when necessary. What always stays is a background, and it cannot be overridden as there is neither a DrawBackground method one could hijack nor a background color let alone a layer that could do the drawing.
The reason some controls like a TextArea can use real overlay scrollers is that they are part of the control itself which does all the handling automagically. So apparently there are ways to hide the background but Apple does not tell us how.
At this moment in time, all I can say is “never say never”, nor is it impossible. You’re looking at NSView properties, you need to look at NSScroller events.
Because the TextView is a NSScrollView with a TextArea as it’s document, which is why it operates as a NSScrollView