[comp.sys.mac.programmer] window location

bowman@reed.UUCP (Eric Bowman) (02/22/90)

Is this the easiest way to get the global location of a window (in C): (?)

locRect = *(Rect *) (*(short **)(((WindowPeek)(theWindow))->contRgn)+1);
	
This works, but it's pretty ugly, and seeing as how Apple recommends
saving window locations, I would think there is an easier way.  Of course,
thinking on these matters is somewhat dangerous...

Thanks,
BoBo
(bowman@reed.bitnet)

ml10+@andrew.cmu.edu (Michael A. Libes) (02/23/90)

>Is this the easiest way to get the global location of a window (in C): (?)
>locRect = *(Rect *) (*(short **)(((WindowPeek)(theWindow))->contRgn)+1);


I use LocalToGlobal to get the window posistion:

   Point p;
   SetPt(&p,wWindow->portRect.left,wWindow->portRect.top);
   SetPort(wWindow);
   LocalToGlobal(&p);


    - luni