Hi,
I really struggle to get the setUIColour to update the current custom lookandfeel:
Here’s the way I update the UIColours inside the property fields of my GUI settings: (this is working)
/** Stores the current LnF ColourScheme **/
auto* currentLookAndFeel = dynamic_cast<LookAndFeel_V4*>(&getLookAndFeel());
auto currentLookAndFeelScheme = currentLookAndFeel->getCurrentColourScheme();
/** Updates UIColours property fields from the current ColourScheme **/
setProperty(Ids::uiPanelUIColourWindowBackground, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::windowBackground).toString());
setProperty(Ids::uiPanelUIColourWidgetBackground, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::widgetBackground).toString());
setProperty(Ids::uiPanelUIColourMenuBackground, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::menuBackground).toString());
setProperty(Ids::uiPanelUIColourOutline, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::outline).toString());
setProperty(Ids::uiPanelUIColourDefaultText, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::defaultText).toString());
setProperty(Ids::uiPanelUIColourDefaultFill, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::defaultFill).toString());
setProperty(Ids::uiPanelUIColourHighlightedText, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::highlightedText).toString());
setProperty(Ids::uiPanelUIColourHighlightedFill, (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::highlightedFill).toString());
setProperty(Ids::uiPanelUIColourMenuText, (String) (String) currentLookAndFeelScheme.getUIColour (ColourScheme::UIColour::menuText).toString());
And this is how I did my script to update all the uiColours of a given LookAndFeel_V4 and update the look of my project with the new colourScheme :
auto* customLookAndFeel = dynamic_cast<LookAndFeel_V4*>(&getLookAndFeel());
auto customLookAndFeelScheme = customLookAndFeel->getCurrentColourScheme();
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::windowBackground, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourWindowBackground)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::widgetBackground, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourWidgetBackground)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::menuBackground, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourMenuBackground)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::outline, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourOutline)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::defaultText, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourDefaultText)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::defaultFill, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourDefaultFill)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::highlightedText, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourHighlightedText)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::highlightedFill, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourHighlightedFill)));
customLookAndFeelScheme.setUIColour(juce::LookAndFeel_V4::ColourScheme::menuText, VAR2COLOUR (owner.getProperty(Ids::uiPanelUIColourMenuText)));
setLookAndFeel(customLookAndFeel);
lookAndFeelChanged();
getUIColour() updates properly my fields in my property pane from the current lookandfeel, but when I update them with the colour picker, it’s supposed to trigger the script above when the value change, and the script should set the lookandfeel with the updated UI colours. I pick the colour, the colour updates un the field, but nothing happens with the GUI lookandfeel, window colours, widgets etc stay the same.
getUIColour is ok, but setUIColour doesn’t affect the UI colour, I’m probably missing something important with the whole process.
If someone who’s used to working with the colourScheme subclass could help that would be awesome.
Thanks in advance.
Damien