Using past version of JUCE code and past LookAndFeel

projucer
gui

#1

I’ve taken on a project where JUCE 4.3 is used rather than JUCE 5. Building this project causes the GUI to not appear how the user wants as it builds with the new LookAndFeels of JUCE 5. Setting the look and feel to LookAndFeel_V3 gets it pretty close, however there are still a few areas where there are differences (namely editable Labels appear black). Is it possible to obtain the old LookAndFeel classes to replicate their build?


#2

Declare this in your main class header :
LookAndFeel_V3 theOldLF;

And in the constructor of that class :
LookAndFeel::setDefaultLookAndFeel(&theOldLF);

It should do the trick (I do that all the time when I update to JUCE 5 my projects)


#3

That is what I’m currently using to attempt to have the JUCE 5 UI, however it still gives the text labels white text, or a black background when selecting (as shown by the left screenshots below - Right is what it should look like).

Screen Shot 2Screen Shot 3


#4

Are you sure that you don’t call the constructor of that label before you do the setDefaultLookAndFeel call ? My trick works only if your labels are created with the new operator after the setDefaultLookAndFeel, with them declared as pointers or ScopedPointers. If not, you can still set manually the LookAndFeel of each component to “theOldLF”


#5

I’m calling the setDefaultLookAndFeel at the top of the MainContentComponent constructor, before anything else happens in the MainContent class. Turns out they aren’t labels which are being incorrectly drawn (my bad), they are sliders with a sliderStyle of incDecButtons, does this change anything?


#6

Are your sliders member variables? If so, they will be constructed before the MainContentComponent constructor…

You could call LookAndFeel::setDefaultLookAndFeel(&theOldLF); in your main function instead, or, if you want to keep it in your MainContentComponent class for some reason, you could do something like this:

LookAndFeel_V3 theOldLF;

struct LookAndFeelLoader
{
    LookAndFeelLoader()   { LookAndFeel::setDefaultLookAndFeel (&theOldLF); }
};

LookAndFeelLoader lAndFLoader;

// Your other member variables go here.
Slider s1, s2;