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

Re: remove-view-from-window



In article <9301051918.AA19536@newton.apple.com> Maurice Sharp writes:
>
>According to both the manual and MCL.help the arguments to
>remove-view-from-window are a view and a window.
>
>This is not correct, there are actually no arguments.
>

Well, actually there seem to be three versions:
	
	The manual says that the argument to remove-view-from-window
	is a view.

	The built-in documentation (c-x c-d) says that the arguments
	are a view and a window.

	If you inspect the function the inspector window says that its
	arglist is nil.

The manual appears to be correct - the function works as one would
expect from its description if you give it a view as an argument.

>My question... is there some alternate method that I can use instead of
>remove-view-from-window to perform actions prior to a views removal from a
>window or subview?

Well, remove-view-from-window seems to work OK at doing that. Here's
some test code to demonstrate that:

(defclass special-view (view) ())

(defmethod view-draw-contents ((s-v special-view))
  (frame-oval s-v #@(0 0) #@(100 100)))  ;so we can see when the view
				         ;is installed

(defmethod install-view-in-window ((s-v special-view) window)
  (set-back-color window *blue-color*)
  (call-next-method s-v window))

(defmethod remove-view-from-window ((s-v special-view))
  (set-back-color (view-container s-v) *red-color*)
  (call-next-method s-v))

(setf the-view (make-instance 'special-view))

(setf the-window (make-instance 'window :color-p t))

;;Then try the following in succession:

(add-subviews the-window the-view)

(remove-subviews the-window the-view)


---------------------------------------------------------------------
John Gersh                                      John_Gersh@jhuapl.edu
The Johns Hopkins University Applied Physics Laboratory
Johns Hopkins Rd., Laurel, MD 20723		       (301) 953-5503