From 2cded82ea69769f357757fb8b30ee48e24f17a60 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 12 Oct 2013 15:44:31 +0100 Subject: [PATCH] Fix for auto-toggle DrawableButtons not updating their image immediately. --- modules/juce_gui_basics/buttons/juce_Button.cpp | 2 +- modules/juce_gui_basics/buttons/juce_DrawableButton.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/buttons/juce_Button.cpp b/modules/juce_gui_basics/buttons/juce_Button.cpp index 1b981220ae..344621692a 100644 --- a/modules/juce_gui_basics/buttons/juce_Button.cpp +++ b/modules/juce_gui_basics/buttons/juce_Button.cpp @@ -308,7 +308,7 @@ void Button::triggerClick() void Button::internalClickCallback (const ModifierKeys& modifiers) { if (clickTogglesState) - setToggleState ((radioGroupId != 0) || ! lastToggleState, dontSendNotification); + setToggleState (radioGroupId != 0 || ! lastToggleState, sendNotification); sendClickMessage (modifiers); } diff --git a/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp b/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp index 74b7e1248d..23225cf81d 100644 --- a/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp @@ -214,7 +214,8 @@ Drawable* DrawableButton::getOverImage() const noexcept Drawable* DrawableButton::getDownImage() const noexcept { - Drawable* const d = getToggleState() ? downImageOn : downImage; + if (Drawable* const d = getToggleState() ? downImageOn : downImage) + return d; - return d != nullptr ? d : getOverImage(); + return getOverImage(); }