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

window system question (activate/deactivate)



I made myself a little window that carries around a floating windoid
tool palette.  I specialized all the window methods I could find with
AFTER methods to either hide or show the palette as appropriate.  Of
course, this didn't work.  When I selected the Listener, say, to
obscure the mother window, the palette remained.  A little debugging
revealed that the obscured window got both DEACTIVATE and then an
ACTIVATE operation.  In fact, the ACTIVATE was the last of the
following methods that were invoked.  What was weirdest of all, when
the ACTIVATE came through, the window was "on top" by its calculation.
Why should the obscured window get anything other than a DEACTIVATE?
And when the ACTIVATE comes through, why is its WINDOW-LAYER
equivalent to the top one?

(defmethod are-you-on-top?  ((self scrolling-window-with-palette))
  (= (window-layer self)
     *windoid-count*))

(defmethod window-close :after ((self scrolling-window-with-palette))
  (when (palette self)
    (window-close (palette self))))

(defmethod window-select :after ((self scrolling-window-with-palette))
  (when (palette self)
    (window-select (palette self))))

(defmethod window-hide :after ((self scrolling-window-with-palette))
  (when (palette self)
    (window-hide (palette self))))

(defmethod window-show :after ((self scrolling-window-with-palette))
  (when (palette self)
    (window-show (palette self))))

(defmethod view-activate-event-handler :after ((self
scrolling-window-with-palette))
  (when (and (palette self) (are-you-on-top? self))
    (window-show (palette self))))

(defmethod view-deactivate-event-handler :after ((self
scrolling-window-with-palette))
  (when (palette self)
    (window-hide (palette self))))

Thanks alot,

--

      -- Philip Greenspun

-------------------------------------------------------------
MIT Department of Electrical Engineering and Computer Science
545 Technology Square, Rm 433, Cambridge, MA 02139, (617) 253-8574
Personal Web URL:  http://www-swiss.ai.mit.edu/~philg/philg.html
summer address:  PO Box 952, Los Alamos, NM 87544 (505) 665-0131