[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: radio-buttons in nested views



The problem occurs when radio buttons are installed in
a view *before* the view has been installed in a window.

The solution is to install the radio buttons in the view
after the view has been installed in the window.

1.  (setq my-window (make-instance 'window))
2.  (setq my-view (make-instance 'view))
3.  (add-subviews my-window my-view)
4.  (add-subviews my-view (make-instance 'button-dialog-item)
			  (make-instance 'button-dialog-item))
The error will occur if you evaluate expression 4 before
expression 3. You can also use classes to accomplish 1-4:
(defclass my-window (window) ())
(defclass my-view (view) ())
(defmethod initialize-instance ((window my-window) &rest init-args)
  (apply #'call-next-method window init-args)
  (add-subviews window (make-instance 'my-view)))
(defmethod initialize-instance ((view my-view) &rest init-args)
  (apply #'call-next-method window init-args)
  (add-subviews window (make-instance 'button-dialog-item)
		       (make-instance 'button-dialog-item)))
(make-instance 'my-window)