diff --git a/modules/juce_gui_basics/buttons/juce_Button.cpp b/modules/juce_gui_basics/buttons/juce_Button.cpp index 9eaddebf3a..cb55e6a33a 100644 --- a/modules/juce_gui_basics/buttons/juce_Button.cpp +++ b/modules/juce_gui_basics/buttons/juce_Button.cpp @@ -308,10 +308,17 @@ void Button::triggerClick() void Button::internalClickCallback (const ModifierKeys& modifiers) { if (clickTogglesState) - setToggleState (radioGroupId != 0 || ! lastToggleState, sendNotification); + { + const bool shouldBeOn = (radioGroupId != 0 || ! lastToggleState); - if (radioGroupId != 0 || ! clickTogglesState) - sendClickMessage (modifiers); + if (shouldBeOn != getToggleState()) + { + setToggleState (shouldBeOn, sendNotification); + return; + } + } + + sendClickMessage (modifiers); } void Button::flashButtonState()