home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-16 | 1.8 KB | 69 lines | [TEXT/YERK] |
- \ radioSet groups a set of item numbers as a set of radio buttons
- \ 7/24/85 cbd Changed on: and off: messages to put:
- \ 7/24/85 cbd Added theDialog as an ivar
- \ 5/23/90 rfl Class Radio added for general radio buttons. RadioSet is for
- \ dialogs
- \ rfl RadioSet stores the selected cell for use when dialog is newed
- \ 11\28\90 rfl added getItem: in radioset
- \ 11\13\91 rfl added put: radio
-
- \ general Radio button class
- :CLASS Radio <super ordered-col
-
- int who-is-on \ could use -1 for no selection
-
- :M GET: get: who-is-on ;M
-
- :M WITHIN: { ind -- b } ind limit < ind 0 >= and ;M
-
- :M OFF: { ind - } ind within: self IF 0 put: [ ind at: self ] THEN ;M
-
- :M ON: { ind - } get: who-is-on off: self
- ind within: self IF 1 put: [ ind at: self ] THEN ind put: who-is-on ;M
-
- ( myctl -- )
- :M clickedOn: indexOf: self IF on: self THEN ;M
-
- :M INIT: { ind - } size: self 0 do i off: self loop 1 put: [ ind at: self ]
- ind put: who-is-on ;M
-
- :M PUT: ( n --) put: who-is-on ;M
-
- ( a1 a2... n -- )
- :M ACTIONS: dup size: self > classErr" 129
- 0 do actions: [ size: self 1- i - at: self ] loop
- ;M
-
- :M hilite: { on/off -- } limit 0 DO on/off hilite: [ i at: self ] LOOP ;M
-
- ;CLASS
-
- \ for use in dialogs
- :CLASS RadioSet <Super byteCol
-
- Var theDialog
- int SelectedCtl
-
- \ ( dialog -- ) associate this radio set with a Dialog
- :M INIT: put: theDialog ;M
-
- \ ( item# -- ) select radio button for item#
- :M SELECT: { item# -- } size: self 0
- DO 0 I at: Self put: [ obj: theDialog ]
- LOOP 1 item# put: [ obj: theDialog ] ;M
-
- \ ( -- item# ) return the radio button that was selected
- :M GET: { -- item# } size: self 0
- DO I at: self get: [ obj: theDialog ]
- IF I at: self leave THEN
- LOOP ;M
-
- :M SET: get: selectedCtl select: self ;M
-
- :M PUT: ( item# --) put: selectedCtl ;M
-
- :M GETITEM: get: selectedCtl ;M
-
- ;CLASS
-
-