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

Re: activating windows...



    Date: Fri, 4 Sep 1992 23:33 MEST
    From: bill%cambridge.apple.com@fhg.de (Bill St. Clair)

    >Is it possible to have a window that is active (i.e. responsive to mouse 
    >actions - say selecting and dragging of icons), but not brought to the 
    >front?

    It's possible, but it takes a little doing (a little more than I
    had thought when I started doing it). Here's an example file that
    illustrates what you need to know to make it work. The important
    thing is that all events get passed through the WINDOW-EVENT
    generic function which dispatches to an xxx-EVENT-HANDLER.
    If you specialize WINDOW-EVENT, you can override the default
    behavior.

    Ciao.

    -Bill


    [...]

    
    ; Drag an outline of the view as returned by VIEW-DRAG-REGION
    ; until the mouse is released. Return the new global position
    ; for the view. Where is the difference between the current mouse
    ; position and the view's position.
    (defmethod drag-view ((view simple-view) where)
      (let (rgn)
	(unwind-protect
	  (rlet ((rect :rect
		       :top -32767 :left -32767
		       :bottom 32767 :right 32767))
	    (setq rgn (view-drag-region view))
	    (with-focused-view *window-manager-view*
	      (#_DragGrayRgn rgn where rect rect #$noConstraint (%null-ptr))
;                                                                ^^^^^^^^
;                                                    pointer to feedback-fn
	      (subtract-points (view-mouse-position nil) where)))
	  (when (and rgn (not (%null-ptr-p rgn)))
	    (#_DisposeRgn rgn)))))


This is a very nice start for some drag-and-drop interaction style, and
that's what we need. However, how can we implement a feedback-function
that provides some feedback to the user (like the finder which
highlights the folder-icons when you drag something onto them)?
_DragGrayRgn wants a pointer to a C-Function, but we dont want to do too
much C-Programming, nor boot the Mac in case the feedback function
errors...

By the way, is there already a proposed protocol for a generalized
drag-and-drop protocol?

Stefan B.

Mail: Stefan Bernemann        ! Phone:  +49-231-9743-139
      c/o FhG IML Dortmund    ! Fax:    +49-231-9743-234
      Emil-Figge-Str. 75      ! Email:  berni@iml.fhg.de
      D-4600 Dortmund 50, FRG !