RadioButton.st
author claus
Sat, 18 Mar 1995 06:16:33 +0100
changeset 104 ca75c90df7a9
parent 86 df2687090a7f
child 105 3d064ba4a0cc
permissions -rw-r--r--
Initial revision

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

Toggle subclass:#RadioButton
       instanceVariableNames:'group'
       classVariableNames:''
       poolDictionaries:''
       category:'Views-Interactors'
!

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

$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
'!

!RadioButton 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/RadioButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
"
!

documentation
"
    like a Toggle, but do not turn off when pressed again, instead only
    turn off when another RadioButton is pressed (see RadioButtonGroup).

    written fall 91 by claus
"
!

examples 
"
    |top panel b group|

    top := StandardSystemView new.
    top extent:200@200.

    panel := HorizontalPanelView
		origin:0.0@0.0
		corner:1.0@1.0
		    in:top.

    group := RadioButtonGroup new.

    b := RadioButton label:'am' in:panel.
    group add:b.

    b := RadioButton label:'fm' in:panel.
    group add:b.

    b := RadioButton label:'off' in:panel.
    group add:b.

    top open
"
! !

!RadioButton methodsFor:'destroying'!

destroy
    self release.
    super destroy
! !

!RadioButton methodsFor:'accessing '!

group
    "return the radioButtonGroup in which I am"

    ^ group
!

group:aButtonGroup
    "set the radioButtonGroup in which I am"

    group := aButtonGroup
! !

!RadioButton methodsFor:'events'!

buttonPress:button x:x y:y
    "radiobuttons change only off-to-on; turning off is done by other
     buttons"

    controller pressed ifFalse:[
	self toggle
    ]
! !