Another one. Sorry for all the questions on a Sunday, an unfortunate side-effect of my being a weekend warrior
Because the scrollbars in Viewport always appear next to it, and in my program I wanted scrollbars that are not immediately next to the viewport they relate to, I hid the viewport scrollbars, and instantiated two scrollbars of my own in the viewportâs containing component, copying the scrollbar functionality from within viewport to make them work the same way.
That worked fine for me until I update to the latest Modules branch yesterday, where now I get the below error:
error C2247: âjuce::AsyncUpdater::cancelPendingUpdateâ not accessible because âjuce::ScrollBarâ uses âprivateâ to inherit from âjuce::AsyncUpdaterâ
This relates to the two lines of code below, repeated for H & V scrollbars inside Viewportâs updateVisibleArea function, and inside my own updateVisibleArea that I copied to:
Well, viewport is a friend class. But looking at it again, I donât like the way I wrote that⊠I think Iâll remove the friend relationship and make the AsyncUpdater a public base (which would also solve your problem).
The âcorrectâ thing to do would actually be to keep the base class private (because itâs an implementation detail, and really shouldnât be used by other classes), but to add a couple of public methods to Scrollbar that provide the functionality that you and the the Viewport needs, but which have more meaningful names. But TBH in this case I canât really think of any better names than youâd get by just exposing the base classâŠ
This is not a request to make those methods accessible to Juce end users necessarily;
Rather, I donât understand technically what is different between Viewport accessing those methods in scrollbar, and my own class, largely a straight-up copy of viewport, not being able to.
So Iâm asking primarily to learn rather than as a feature request.
Itâs an interesting question. One of the trickiest parts of doing a library is keeping the balance right between exposing too much or too little of the way classes work.