Hi guys,
I think i have found an issue with the Slider text box ignoring look and feel if the default text box position or size are used. I created a new project to test this and was able to reproduce the issue.
In short… in my LookAndFeel, I do something like…
setColour (Slider::ColourIds::textBoxBackgroundColourId, Colours::hotpink);
And then in my Component class I create a slider…
Slider testSlider;
in the constructor I add it…
addAndMakeVisible (testSlider);
and then I draw it. But the hotpink colour is ignored (I did apply the LookAndFeel, of course).
Then if I change the text box style or size away from default values it will become hotpink, as per my (pretend) look and feel…e.g. using
testSlider.setTextBoxStyle (Slider::TextBoxLeft, false, 81, 20);
or
testSlider.setTextBoxStyle (Slider::TextBoxRight, false, 80, 20);
But then, to demonstrate the issue, I just apply the default parameters and build again,
testSlider.setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
and it ignores the look and feel.
I think this is caused by setTextBoxStyle() in juce_Slider.cpp having an if statement that checks if nothing has changed and if so, doesn’t call lookAndFeelChanged(). That makes sense for new updates, but perhaps something like this is happening for the initialisation of the Slider and that is stopping it from applying the look and feel?
(Of course, I can fix this in several ways myself by applying colours or calling lookAndFeelChanged() directly, but one would expect the default slider text box to use the look and feel colours set in the look and feel class)
Thanks!
Adam