[comp.sys.mac.programmer] Question about GlobalToLocal

fields@jvnca.csc.org (Derek Fields lac11191) (01/05/90)

I am a relatively new Mac programmer playing with Think C vers. 4.0.  I
am trying to learn to work with controls and windows and have a problem
with GlobalToLocal.  My code is below:

				cPart = FindWindow(theEvent.where, &curwind);
				SelectWindow(curwind);
				click = theEvent.where;
				GlobalToLocal(&click);
				cPart = FindControl (click, curwind, &move);

When I watch the variables theEvent.where and click I find the following
behavior:

	click = -211,-442 when theEvent.where = 109,46
	click = -209,-398 when theEvent.where = 111,90

It appears that the local coordinate system is defined with the origin
near the bottom, right of the window, but I know that this is not the
case because I tried setting the origin to 0,0 and had no change in behavior.

In case it is important, the window was set up with NewWindow and with the
Rect = 50,10,300,400.  I would have expected that GlobalToLocal
at 109,46 would have returned 49,36.

If you can help, please email me.


!-----------------------------------------------------------------------------!
! C. Derek Fields                             ! fields@jvncc (bitnet)         !
! Team Leader, User Administration            ! fields@jvnca.csc.org (ARPA)   !
! JvNC, 665 College Rd., Princeton, NJ 08540  ! (609) 520-2000 (BellNet)      !
!-----------------------------------------------------------------------------!