[comp.sys.mac.programmer] DragHook question

GG.DAR@forsythe.stanford.edu (Aaron Reizes) (10/18/89)

How to use the DragHook.

I want to display the size of the window while a user is changing
the size with the GrowBox.  GrowWindow will call a routine through
the DragHook pointer if I set it to point to my routine.

Unfortunately, there are no parameters passed with this call.  Is
there a way to know the coordinates of the current drag rectangle
from the DragHook routine?

Thanks,

Aaron Reizes
reizes@forsythe.stanford.edu

6600pete@ucsbuxa.ucsb.edu (10/18/89)

In article <5233@lindy.Stanford.EDU> GG.DAR@forsythe.stanford.edu (Aaron Reizes) writes:

> Is there a way to know the coordinates of the current drag rectangle
> from the DragHook routine?

I would imagine that since the front window is the one that gets its
size box dragged, you could dereference FrontWindow, or, better, put a
WindowPeek in a global and dereference that.

mnkonar@gorby.SRC.Honeywell.COM (Murat N. Konar) (10/18/89)

In article <2583@hub.UUCP> pete@cavevax.ucsb.edu writes:
>In article <5233@lindy.Stanford.EDU> GG.DAR@forsythe.stanford.edu (Aaron Reizes) writes:
>
>> Is there a way to know the coordinates of the current drag rectangle
>> from the DragHook routine?
>
>I would imagine that since the front window is the one that gets its
>size box dragged, you could dereference FrontWindow, or, better, put a
>WindowPeek in a global and dereference that.

Careful now. Think twice about this!  

In applications that use floating palettes (Hypercard, MacPaint 2.0, Fullpaint,
etc.) the front window IS NOT NECESSARILY THE ONE THAT GETS DRAGGED!  Even under
more traditional applications, the user can drag a window without activating 
it by holding down the command key.  

 
____________________________________________________________________
Have a day. :^|
Murat N. Konar        Honeywell Systems & Research Center, Camden, MN
mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar(UUCP)

6600pete@ucsbuxa.ucsb.edu (10/18/89)

In article <35304@srcsip.UUCP> mnkonar@gorby.SRC.Honeywell.COM (Murat N. Konar) writes:
> Even under more traditional applications, the user can drag a window
> without activating it by holding down the command key.  

You sure about that? I know one can drag the title bar with command held
down, but can you RESIZE with command held down? I don't think so. I'm
away from my Mac, so someone ought to check this out...

Otherwise, unless you're playing with floating pallettes, checking
FrontWindow from DragHook should work.
--

-------------------------------------------------------------------
GurgleKat (Pete Gontier)
pete@cavevax.ucsb.edu
...if you'd gone to Dartmouth, you'd not have had to take the math.

davet@oakhill.UUCP (David Trissel) (10/18/89)

In article <5233@lindy.Stanford.EDU> GG.DAR@forsythe.stanford.edu (Aaron Reizes) writes:

>I want to display the size of the window while a user is changing
>the size with the GrowBox.  GrowWindow will call a routine through
>the DragHook pointer if I set it to point to my routine.

>Unfortunately, there are no parameters passed with this call.  Is
>there a way to know the coordinates of the current drag rectangle
>from the DragHook routine?

I wrote an application which does this. I save the current window
pointer and the current mouse position in my own global variables.
The draghook routine then saves the current port, sets the current port to
the saved window's port, does a GetMouse call to track the mouse movements
and then restores the original port.

 -- Dave Trissel, Austin