Scroll Bar Over Conent of viewport

I have been trying to figure out a way to move my scroll bar over the content of a viewport with no luck. I just want to move it 10 pixels to the left without it removing the edge of the content.

Any thoughts?


Can a custom LookAndFeel_V4::drawScrollbar() help? You can draw the scrollbar however you want.

Currently facing the same issue and no, unfortunately the available LAF methods don’t offer any way to position the scroll bar it seems :frowning:

Looking into the Viewport code it looks, like a vertical scrollbar is always strictly positioned at the right edge of the content, a horizontal one is always positioned below and there’s no way to set an indent or anything like that.

Bummer, guess I’ll hack Juce and add an indent here, since I’m working on a fork anyways… I’ll share it (or any other solution I find) once I’m done

I did this a few years ago. In my case, I also wanted for the scrollbars to appear only when the mouse is in the scrollbar areas. Since I didn’t want to hack JUCE, this class basically hides the original scrollbars in the Viewport class and adds new ones. Here’s the code, maybe it can help you.

AnimatedScrollBarsViewport.h (4.0 KB)


Oh, that’s a way better solution @masshacker, thank you!
I was just about to start hacking an indent variable into the juce class, but this is actually a way better approach, I’ll absolutely go down that path instead.