I just noticed that there is no way to set the TextEditor’s vertical ScrollBar’s colour id’s, or just the thumb colour is really what I’m looking for.
You can override these methods implemented in LookAndFeel and implement your version of the scrollbar look and feel.
I have my own LookAndFeel class…
I need to change the thumb colour of the scroll-bar in one of my text editors. Usually Jules would provide a getScrollBar() method to get access to these types of internals e.g. ListBox::getVerticalScrollBar()
If the scroll-bar is there then one would like the option to utilize the ScrollBar::ColourIds no?
getViewport() would be nice…
If you set a custom look and feel for the texteditor, it’ll be inherited by the scrollbar, so should do what you need, shoudn’t it?
Please correct me if am wrong, Are you trying to create a separate look for only few scroll bar.
This code should give you access to the view port.
_pViewPort = dynamic_cast<juce::Viewport*>(_pEditor->getChildComponent (0));
But I am not very sure, how helpful it could be.
So I have to make a separate look and feel just to get a different thumb colour for just one of my text editors.
That would work, but if the child hierarchy changes in the future (for some bizarre reason) it would break. I guess I can iterate through all the children and make sure that the pointer I’m grabbing is in fact a view- port. (Safer this way).
Well yes… You don’t need to write a new class, you can just use a LookAndFeel object and change its colours. It’s only a couple of lines of code.
I was working with a shared l&f object, and changing the colour with
setColour (ScrollBar::thumbColourId, Colours::blue); would change all my scroll bars… So I’ll make another instance for the editor that needs the special colour. Great.
Just out of curiosity, why does ListBox have
I know it says:
[quote]Returns a pointer to the scrollbar.
(Unlikely to be useful for most people).[/quote]
[quote]Just out of curiosity, why does ListBox have
Just in case you need to do stuff like setting the scroll increments, etc.