setColour not working on Viewport Sliders


#1

Since the default vertical slider comes up as almost black on black and almost invisible, I’m trying to set the colours to match the other sliders in use. I have tried:

		ScrollBar *sb = TrackView.getVerticalScrollBar();
		if(sb == 0){
			AlertWindow::showMessageBox	(	AlertWindow::InfoIcon, "Alert", "Scroll Bar Null" );
		}
		sb->setColour (Slider::backgroundColourId, Colours::white);
		sb->setColour (Slider::thumbColourId, Colour (0xff171741));
		sb->setColour (Slider::trackColourId, Colours::grey);

I get a valid pointer back, but setColour has no effect. I call this after creating the viewport and then again after the component it contains grows enough so the slider is visible (and every addition after that).
How can I reset the Viewport Slider colours?


#2

A Scrollbar isn’t a Slider

m_ViewPort.getHorizontalScrollBar()->setColour (ScrollBar::thumbColourId, Colours::silver);

and you only need to set it once.

Rail


#3

Duh! I should be more careful.
Thanks!