1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Changed the order in which radio-group toggle button events are sent, so that the "off" event is sent before the "on".

This commit is contained in:
jules 2013-11-13 11:08:59 +00:00
parent aa9241a14a
commit 062c85db12

View file

@ -165,14 +165,22 @@ void Button::setToggleState (const bool shouldBeOn, const NotificationType notif
{
if (shouldBeOn != lastToggleState)
{
WeakReference<Component> deletionWatcher (this);
if (shouldBeOn)
{
turnOffOtherButtonsInGroup (dontSendNotification);
if (deletionWatcher == nullptr)
return;
}
if (getToggleState() != shouldBeOn) // this test means that if the value is void rather than explicitly set to
isOn = shouldBeOn; // false, it won't be changed unless the required value is true.
lastToggleState = shouldBeOn;
repaint();
WeakReference<Component> deletionWatcher (this);
if (notification != dontSendNotification)
{
// async callbacks aren't possible here
@ -184,14 +192,6 @@ void Button::setToggleState (const bool shouldBeOn, const NotificationType notif
return;
}
if (lastToggleState)
{
turnOffOtherButtonsInGroup (dontSendNotification);
if (deletionWatcher == nullptr)
return;
}
if (notification != dontSendNotification)
sendStateMessage();
}