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:
parent
aa9241a14a
commit
062c85db12
1 changed files with 10 additions and 10 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue