[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
making dialog items invisible
- Subject: making dialog items invisible
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Mon, 24 May 1993 11:31:28 -0600
At 11:51 AM 5/23/93 -0400, Mark A. Tapia wrote:
>Stacy Marsella writes on Sun May 23 00:55:30 1993:
> Any suggestions as to how one can make dialog items
> invisible - e.g., something that has the functionality
> of window-show and window-hide.
>Provided that you're using MCL2.0, the view-hide and view-show
>functions will do exactly what you want.
> (setq win (make-instance 'window))
> (setq dialog-item (make-instance 'editable-text-dialog-item
> :view-size (make-point 100 20)))
> (add-subviews win dialog-item)
> ; (view-hide dialog-item)
> ; (view-show dialog-item)
>mark
I don't believe that view-hide and view-show are part of MCL 2.0, though
they are certainly not hard to write. The two ways that spring to
mind are using SET-VIEW-POSITION to move the view far away from the view
port, and using SET-VIEW-CONTAINER to remove it from it's parent view.
I'd probably do it something like the following:
(defmethod view-hide ((self window))
(window-hide self))
(defmethod view-show ((self window))
(window-show self))
(defmethod view-hide ((self simple-view))
(let ((container (view-container self)))
(when container
(setf (view-get self :saved-container) container)
(set-view-container self nil))))
(defmethod view-show ((self simple-view))
(unless (view-container self)
(let ((container (view-get self :saved-container)))
(unless container
(error "No saved container for ~s" self))
(set-view-container self container)
(setf (view-get self :saved-container) nil))))