RButtGrp.st
author claus
Wed, 24 Aug 1994 01:38:59 +0200
changeset 51 e895ac4cc7c8
parent 38 4b9b70b2cc87
child 59 450ce95a72a4
permissions -rw-r--r--
support non-string entries

"
 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.
"

OrderedCollection subclass:#RadioButtonGroup
         instanceVariableNames:''
         classVariableNames:''
         poolDictionaries:''
         category:'Views-Support'
!

RadioButtonGroup comment:'
COPYRIGHT (c) 1991 by Claus Gittinger
              All Rights Reserved

$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.5 1994-08-07 13:23:13 claus Exp $
'!

!RadioButtonGroup class methodsFor:'documentation '!

copyright
"
 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.
"
!

version
"
$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.5 1994-08-07 13:23:13 claus Exp $
"
!

documentation
"
    RadioButtonGroups control the interaction between RadioButtons
    turning off other button(s) when one of the group is pressed.
"
! !

!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"

    "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
            ]
        ]
    ]

! !