;******************************************************************************
;
; File name    : mkRadio.stk
; Creation     : Jul-29-1993
; Modification : Aug-16-1993
;
;******************************************************************************
;
; STk adaptation of the Tk widget demo.
;
; mkRadio:
; Create a top-level window that displays a bunch of radio buttons.
;
;******************************************************************************

(provide "mkRadio")

(define (mkRadio)
  (catch (destroy .top-radio))
  (toplevel ".top-radio")
  (dpos .top-radio)
  (wm 'title .top-radio "Radiobutton Demonstration")
  (wm 'iconname .top-radio "Radiobuttons")
  (message ".top-radio.m"
	   :font "-Adobe-times-medium-r-normal--*-180*"
	   :aspect 300
	   :text "Two groups of radiobuttons are displayed below.  If you click on a button then the button will become selected exclusively among all the buttons in its group.  A STk variable is associated with each group to indicate which of the group's buttons is selected.\n\nClick the \"See Variables\" button to see the current values of the variables.\n\nClick the \"OK\" button when you've seen enough.")
    (frame ".top-radio.f" :borderwidth 10)
    (pack 'append .top-radio.f
	  [frame ".top-radio.f.left"] "left expand"
	  [frame ".top-radio.f.right"] "right expand")
    (pack 'append .top-radio.f.left
	  [radiobutton ".top-radio.f.left.b1"
		       :text "Point Size 10" :variable 'size
		       :relief "flat" :value 10]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.left.b2"
		       :text "Point Size 12" :variable 'size
		       :relief "flat" :value 12]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.left.b3"
		       :text "Point Size 18" :variable 'size
		       :relief "flat" :value 18]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.left.b4"
		       :text "Point Size 24" :variable 'size
		       :relief "flat" :value 24]
	  "top pady 4 frame w")
    (pack 'append .top-radio.f.right
	  [radiobutton ".top-radio.f.right.b1"
		       :text "Red" :variable 'color 
		       :relief "flat" :value "red"]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.right.b2"
		       :text "Green" :variable 'color 
		       :relief "flat" :value "green"]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.right.b3"
		       :text "Blue" :variable 'color
		       :relief "flat" :value "blue"]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.right.b4"
		       :text "Yellow" :variable 'color
		       :relief "flat" :value "yellow"]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.right.b5"
		       :text "Orange" :variable 'color
		       :relief "flat" :value "orange"]
	  "top pady 4 frame w"
	  [radiobutton ".top-radio.f.right.b6"
		       :text "Purple" :variable 'color
		       :relief "flat" :value "purple"]
	  "top pady 4 frame w")
    (frame ".top-radio.f2")
    (pack 'append .top-radio.f2
;	  [button ".top-radio.f2.ok" :text "OK" :command '(destroy .top-radio)]
	  [button ".top-radio.f2.ok" :text "OK"
		  :command '(begin
			      (catch (destroy .top-radio.d))
			      (destroy .top-radio))]
; Sinon on se prend:
; X Error of failed request:  BadMatch (invalid parameter attributes)
	  "left expand fill"
	  [button ".top-radio.f2.vars" 
		  :text "See Variables"
		  :command '(showVars ".top-radio.d" 'size 'color)]
	  "left expand fill")
    (button ".top-radio.ok" :text "OK" :command '(destroy .top-radio))

    (pack 'append .top-radio
	  .top-radio.m "top fill"
	  .top-radio.f "top expand fill"
	  .top-radio.f2 "bottom fill"))
