RadioButtonGroup.st
changeset 105 3d064ba4a0cc
parent 86 df2687090a7f
child 116 be0971c081e2
--- a/RadioButtonGroup.st	Sat Mar 18 06:16:33 1995 +0100
+++ b/RadioButtonGroup.st	Sat Mar 18 06:16:50 1995 +0100
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.5 on 14-mar-1995 at 11:06:48 am'!
+
 OrderedCollection subclass:#RadioButtonGroup
 	 instanceVariableNames:''
 	 classVariableNames:''
@@ -21,7 +23,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.8 1995-02-16 03:12:56 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.9 1995-03-18 05:15:46 claus Exp $
 '!
 
 !RadioButtonGroup class methodsFor:'documentation '!
@@ -42,7 +44,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.8 1995-02-16 03:12:56 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.9 1995-03-18 05:15:46 claus Exp $
 "
 !
 
@@ -69,8 +71,9 @@
 
 add:aRadioButton
     super add:aRadioButton.
-    aRadioButton addDependent:self.
-    aRadioButton group:self
+    aRadioButton model:self; change:#elementChanged:from:.
+"/    aRadioButton addDependent:self.
+    (aRadioButton respondsTo:#group) ifTrue:[aRadioButton group:self]
 ! !
 
 !RadioButtonGroup methodsFor:'update'!
@@ -80,19 +83,39 @@
 
     "a RadioButton in this group has changed - notify the others"
 
-    "in case we have a toggle in the group, 
-     and it has been turned off - turn it on again
-    "
-    changedButton isOn ifFalse:[
-	changedButton toggleNoAction.
-	^ self
-    ].
+"/    "in case we have a toggle in the group, 
+"/     and it has been turned off - turn it on again
+"/    "
+"/    changedButton isOn ifFalse:[
+"/        changedButton toggleNoAction.
+"/        ^ self
+"/    ].
+    self do:[:aButton |
+        (aButton == changedButton) ifFalse:[
+            aButton isOn ifTrue:[
+                aButton turnOff
+            ]
+        ]
+    ]
+!
+
+elementChanged:aToggle
     self do:[:aButton |
-	(aButton == changedButton) ifFalse:[
-	    aButton isOn ifTrue:[
-		aButton turnOff
-	    ]
-	]
+        (aButton == aToggle) ifFalse:[
+            aButton isOn ifTrue:[
+                aButton turnOff
+            ]
+        ]
     ]
+!
 
+elementChanged:newValue from:aToggle
+    self do:[:aButton |
+        (aButton == aToggle) ifFalse:[
+            aButton isOn ifTrue:[
+                aButton turnOff
+            ]
+        ]
+    ]
 ! !
+