https://github.com/libsdl-org/Maelstrom/commit/f5d8b56720dbf180f45fdbc9ed15eef1727e6aff
From f5d8b56720dbf180f45fdbc9ed15eef1727e6aff Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 30 Oct 2011 12:10:59 -0400
Subject: [PATCH] Use OnClick() so changing radio buttons will trigger any
button callbacks.
---
screenlib/UIElementCheckbox.cpp | 4 ++--
screenlib/UIElementRadio.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/screenlib/UIElementCheckbox.cpp b/screenlib/UIElementCheckbox.cpp
index beb0f9ff..62a771ce 100644
--- a/screenlib/UIElementCheckbox.cpp
+++ b/screenlib/UIElementCheckbox.cpp
@@ -49,7 +49,7 @@ UIElementCheckbox::Load(rapidxml::xml_node<> *node, const UITemplates *templates
void
UIElementCheckbox::OnClick()
{
- UIElementButton::OnClick();
-
SetChecked(!m_checked);
+
+ UIElementButton::OnClick();
}
diff --git a/screenlib/UIElementRadio.cpp b/screenlib/UIElementRadio.cpp
index 8d20a75f..0715b2a3 100644
--- a/screenlib/UIElementRadio.cpp
+++ b/screenlib/UIElementRadio.cpp
@@ -56,8 +56,8 @@ UIElementRadioGroup::RadioButtonChecked(UIElementRadioButton *button)
FindElements<UIElementRadioButton>(buttons);
for (unsigned i = 0; i < buttons.length(); ++i) {
- if (buttons[i] != button) {
- buttons[i]->SetChecked(false);
+ if (buttons[i] != button && buttons[i]->IsChecked()) {
+ buttons[i]->OnClick();
}
}
m_value = button->GetID();