0
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
3 |
All Rights Reserved
|
0
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
7
|
13 |
OrderedCollection subclass:#RadioButtonGroup
|
59
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Support'
|
0
|
18 |
!
|
|
19 |
|
|
20 |
RadioButtonGroup comment:'
|
5
|
21 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
22 |
All Rights Reserved
|
0
|
23 |
|
86
|
24 |
$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.8 1995-02-16 03:12:56 claus Exp $
|
38
|
25 |
'!
|
|
26 |
|
|
27 |
!RadioButtonGroup class methodsFor:'documentation '!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
32 |
All Rights Reserved
|
0
|
33 |
|
38
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
86
|
45 |
$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.8 1995-02-16 03:12:56 claus Exp $
|
38
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
RadioButtonGroups control the interaction between RadioButtons
|
|
52 |
turning off other button(s) when one of the group is pressed.
|
63
|
53 |
To group some buttons (and have one-on behavior) use:
|
|
54 |
|
|
55 |
|g|
|
|
56 |
|
|
57 |
g := RadioButtonGroup new.
|
|
58 |
...
|
|
59 |
b1 := RadioButton label:....
|
|
60 |
g add:b1
|
|
61 |
...
|
|
62 |
b2 := RadioButton label:....
|
|
63 |
g add:b2
|
|
64 |
...
|
38
|
65 |
"
|
|
66 |
! !
|
0
|
67 |
|
|
68 |
!RadioButtonGroup methodsFor:'adding / removing'!
|
|
69 |
|
|
70 |
add:aRadioButton
|
|
71 |
super add:aRadioButton.
|
86
|
72 |
aRadioButton addDependent:self.
|
|
73 |
aRadioButton group:self
|
0
|
74 |
! !
|
|
75 |
|
|
76 |
!RadioButtonGroup methodsFor:'update'!
|
|
77 |
|
59
|
78 |
update:something with:someArgument from:changedButton
|
|
79 |
(self includes:changedButton) ifFalse:[^ self].
|
|
80 |
|
0
|
81 |
"a RadioButton in this group has changed - notify the others"
|
|
82 |
|
38
|
83 |
"in case we have a toggle in the group,
|
|
84 |
and it has been turned off - turn it on again
|
|
85 |
"
|
|
86 |
changedButton isOn ifFalse:[
|
59
|
87 |
changedButton toggleNoAction.
|
|
88 |
^ self
|
38
|
89 |
].
|
0
|
90 |
self do:[:aButton |
|
59
|
91 |
(aButton == changedButton) ifFalse:[
|
|
92 |
aButton isOn ifTrue:[
|
|
93 |
aButton turnOff
|
|
94 |
]
|
|
95 |
]
|
0
|
96 |
]
|
|
97 |
|
|
98 |
! !
|