RButtGrp.st
changeset 0 e6a541c1c0eb
child 3 9d7eefb5e69f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RButtGrp.st	Fri Jul 16 11:44:44 1993 +0200
@@ -0,0 +1,53 @@
+"
+ COPYRIGHT (c) 1991 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+VariableArray subclass:#RadioButtonGroup
+	 instanceVariableNames:'buttonGroup'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Views-Support'
+!
+
+RadioButtonGroup comment:'
+
+COPYRIGHT (c) 1991 by Claus Gittinger
+              All Rights Reserved
+
+RadioButtonGroups controll the interaction between RadioButtons
+turning off other button(s) when one of the group is pressed.
+
+@(#)RButtGrp.st	3.1 92/08/23
+written nov 91 by claus
+'!
+
+!RadioButtonGroup methodsFor:'adding / removing'!
+
+add:aRadioButton
+    super add:aRadioButton.
+    aRadioButton addDependent:self
+! !
+
+!RadioButtonGroup methodsFor:'update'!
+
+update:changedButton
+    "a RadioButton in this group has changed - notify the others"
+
+    self do:[:aButton |
+        (aButton == changedButton) ifFalse:[
+            aButton isOn ifTrue:[
+                aButton turnOff
+            ]
+        ]
+    ]
+
+! !
+