Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Help locating click in OS X

 
   Macintosh computer (Home) -> General Discussion RSS
Next:  Developing for Jaguar on Panther?  
Author Message
John A. Dundas III

External


Since: Oct 31, 2003
Posts: 3



(Msg. 1) Posted: Fri Oct 31, 2003 1:35 pm
Post subject: Help locating click in OS X
Archived from groups: comp>sys>mac>programmer>misc (more info?)

I have an event handler for mouse down events in the content region of a
window (under Carbon). To set up the handler, I have used the following
code:

EventTypeSpec mdEvent = { kEventClassWindow, kEventWindowClickContentRgn };
InstallEventHandler (GetWindowEventTarget (theWind),
NewEventHandlerUPP (theHandler), 1, &mdEvent, NULL, NULL);

Within theHandler(), I have code similar to the following:

GetPort (&prevPort);
SetPortWindowPort (theWind);
GetEventParameter (event, kEventParamWindowMouseLocation, typeQDPoint, NULL,
sizeof (where), NULL, &where);
if (PtInRect (where, &theRect))
...

I thought kEventParamWindowMouseLocation would return coordinates in
screen relative terms. This seems to be generally true, though the
vertical coordinates apprear to NOT take into account the top window
frame. [This is a standard document window with the three buttons in the
top left corner.]

Under older Mac OS versions I would grab the global coordinates of the
mouseDown and perform a GlobalToLocal() conversion. This worked correctly
and did take the window frame into account.

I am very new to OS X programming. Am I doing this incorrectly? What is
the right way?

Thanks,

John

--
John A. Dundas III
Director, Information Technology Services, Caltech
Mail Code: 014-81, Pasadena, CA 91125-8100
Phone: 626.395.3392 FAX: 626.449.6973

 >> Stay informed about: Help locating click in OS X 
Back to top
Login to vote
John A. Dundas III

External


Since: Oct 31, 2003
Posts: 3



(Msg. 2) Posted: Fri Oct 31, 2003 4:09 pm
Post subject: Re: Help locating click in OS X [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Guess I answered my own question. I should be using
kEventParamMouseLocation and GlobalToLocal() rather than
kEventParamWindowMouseLocation.

John

--
John A. Dundas III
Director, Information Technology Services, Caltech
Mail Code: 014-81, Pasadena, CA 91125-8100
Phone: 626.395.3392 FAX: 626.449.6973

 >> Stay informed about: Help locating click in OS X 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]