;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; STk adaptation of the Tk widget demo.
;;;;
;;;; This demonstration script creates a toplevel window containing
;;;; several  radiobutton widgets.
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require "Button")
(define (demo-radio)
  (let* ((w      (make-demo-toplevel "radio"
				     "Radiobutton Demonstration"
				     "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 Tcl variable is associated with each group to indicate which of the group's buttons is selected.  Click the \"See Variables\" button to see the current values of the variables."
				     'radio-size 'radio-color))
	 (radios (make  :parent w))
	 (left   (make  :parent radios))
	 (right  (make  :parent radios)))
	;; Create radiobuttons
	(for-each (lambda (pt)
		    (pack (make 
				:parent left
				:text (format #f "Point Size ~A" pt)
				:variable 'radio-size
				:relief "flat"
				:width 15
				:anchor "w"
				:value pt)))
		  '(10 12 18 24))
	
	(for-each (lambda (color)
		    (pack (make 
				:parent right
				:text color 
				:variable 'radio-color
				:relief "flat"
				:width 15
				:anchor "w"
				:value color)))
		  '("Red" "Green" "Blue" "Yellow" "Orange" "Purple"))
	
	(pack left right :side "left" :expand #f :pady ".5c" :padx ".5c")
	(pack radios)))