ToggleButton warning "was declared deprecated" when compiling setToggleState(bool, bool)


#1

Hi all,
I’m using JUCE 5.2.0, I just wrote a code shows a ToggleButton. Here is my code


addAndMakeVisible(tgbCheck); // ToggleButton tgbCheck
tgbCheck.setToggleState(true, false); // I want it was checked as default

When I compiled my code using visual studio 2017, It generated a warning:
“… warning C4996: ‘juce::Button::setToggleState’: was declared deprecated (compiling source file …”

What is the wrong step here and how to solve this warning?


#2

The method was changed a long time ago… and the second parameter is now a NotificationType

Rail


#3

If you look at the handy comment above the warning here (which Visual Studio will take you to if you double click on the warning) you’ll see that it’s been replaced with this new method.