Viewport & custom scrollBars

Could we get a virtual method added to Viewport that would be called to create each scrollbar :

virtual ScrollBar* createScrollBarComponent (bool isVertical);

That would allow us to set up custom scrollbars (for more than simple lnf tweaks) through subclassing.
edit: fixed typo in the patch
patch.txt (8,8 Ko)

Seems like a sensible request, I’ll sort that out, ta.

1 Like

I left a comment here: https://github.com/WeAreROLI/JUCE/commit/a4f5663fce97d8daec83df32bc67425dcb1bffe7#diff-0ba8ab46554278b8271142f3517b9790
but I’m not sure if that will reach the right people…

Here it is for visibility:

I can’t see how this is going to work if createScrollBarComponent is called during the constructor as derived classes won’t have been constructed yet so it can’t call any overridden method. It always calls Viewport::createScrollBarComponent.

Perhaps we need a refreshScrollbars method or similar?

hmm, good point, I’ll take a look.