value assigned to value holder can be defined
authorca
Sun, 15 Jun 1997 12:09:05 +0200
changeset 1245 162b71744f37
parent 1244 5a1e81b3cdd4
child 1246 9033af51413c
value assigned to value holder can be defined
RButtGrp.st
RadioButtonGroup.st
--- a/RButtGrp.st	Wed Jun 11 16:07:08 1997 +0200
+++ b/RButtGrp.st	Sun Jun 15 12:09:05 1997 +0200
@@ -232,7 +232,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.25 1997-03-01 13:14:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.26 1997-06-15 10:09:05 ca Exp $'
 ! !
 
 !RadioButtonGroup methodsFor:'adding / removing'!
@@ -240,41 +240,37 @@
 add:aRadioButton
     "add a radioButton to the group - actually, this name is misleading;
      it simple creates an adaptor, which converts my value into a boolean,
-     depending on the buttons index-number"
-
-    |c idx adaptor|
+     depending on the buttons index-number
+    "
+    self add:aRadioButton value:nil
+!
 
-    numberOfValues isNil ifTrue:[
-        numberOfValues := 0.
-    ].
-    numberOfValues := numberOfValues + 1.
+add:aRadioButton value:aValue
+    "add a radioButton to the group - actually, this name is misleading;
+     it simple creates an adaptor, which converts my value into a boolean,
+     depending on the buttons index-number or aValue"
 
-    idx := numberOfValues.
+    |adaptor select|
 
+    numberOfValues := numberOfValues ? 0 + 1.
     adaptor := PluggableAdaptor on:self.
-    adaptor getBlock:[:m | m value == idx]
+    select  := aValue ? numberOfValues.
+
+    adaptor getBlock:[:m |m value == select]
             putBlock:[:m :onOff | 
                            onOff ifTrue:[
-                               m value:idx
+                               m value:select
                            ] ifFalse:[
-                               idx == value ifTrue:[
+                               select == value ifTrue:[
                                    m value:nil 
                                ]
                            ]
                      ]
-            updateBlock:[:m :a :v | true].
+         updateBlock:[:m :a :v | true].
 
     aRadioButton isOn ifTrue:[
-        self value:idx.
+        self value:select.
     ].
     aRadioButton model:adaptor.
-
-"/    (c := aRadioButton controller) notNil ifTrue:[
-"/        c beRadioButton
-"/    ] ifFalse:[    
-"/        aRadioButton controller:(RadioButtonController new).
-"/    ]
-
-    "Modified: 1.3.1997 / 13:58:32 / cg"
 ! !
 
--- a/RadioButtonGroup.st	Wed Jun 11 16:07:08 1997 +0200
+++ b/RadioButtonGroup.st	Sun Jun 15 12:09:05 1997 +0200
@@ -232,7 +232,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.25 1997-03-01 13:14:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.26 1997-06-15 10:09:05 ca Exp $'
 ! !
 
 !RadioButtonGroup methodsFor:'adding / removing'!
@@ -240,41 +240,37 @@
 add:aRadioButton
     "add a radioButton to the group - actually, this name is misleading;
      it simple creates an adaptor, which converts my value into a boolean,
-     depending on the buttons index-number"
-
-    |c idx adaptor|
+     depending on the buttons index-number
+    "
+    self add:aRadioButton value:nil
+!
 
-    numberOfValues isNil ifTrue:[
-        numberOfValues := 0.
-    ].
-    numberOfValues := numberOfValues + 1.
+add:aRadioButton value:aValue
+    "add a radioButton to the group - actually, this name is misleading;
+     it simple creates an adaptor, which converts my value into a boolean,
+     depending on the buttons index-number or aValue"
 
-    idx := numberOfValues.
+    |adaptor select|
 
+    numberOfValues := numberOfValues ? 0 + 1.
     adaptor := PluggableAdaptor on:self.
-    adaptor getBlock:[:m | m value == idx]
+    select  := aValue ? numberOfValues.
+
+    adaptor getBlock:[:m |m value == select]
             putBlock:[:m :onOff | 
                            onOff ifTrue:[
-                               m value:idx
+                               m value:select
                            ] ifFalse:[
-                               idx == value ifTrue:[
+                               select == value ifTrue:[
                                    m value:nil 
                                ]
                            ]
                      ]
-            updateBlock:[:m :a :v | true].
+         updateBlock:[:m :a :v | true].
 
     aRadioButton isOn ifTrue:[
-        self value:idx.
+        self value:select.
     ].
     aRadioButton model:adaptor.
-
-"/    (c := aRadioButton controller) notNil ifTrue:[
-"/        c beRadioButton
-"/    ] ifFalse:[    
-"/        aRadioButton controller:(RadioButtonController new).
-"/    ]
-
-    "Modified: 1.3.1997 / 13:58:32 / cg"
 ! !