Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contextual menu and compositing window




On Mar 27, 2007, at 9:57 AM, Chinh Nguyen wrote:

I've got a floating compositing window I load from a NIB populated with a bunch of bevel buttons, a static text field, and a separator.  For contextual menu support, I installed a kEventControlContextualMenuClick handler to the content view.  When I right click on the window, if my click lands on the static text control, separator, or window, my contextual menu appears in the correct place.  But if I right click on a bevel button, my contextual menu appears in the wrong place.  After some debugging, it appears that even though I installed my contextual menu handler on the content view, the kEventParamDirectObject I get back is whatever control I right clicked on.  And right clicking on a bevel button returns a point relative to the bevel button, not the content view (even though the other controls are handled properly).  Is this normal?

Yes, that's normal. The direct object is placed in the event when it's first sent. The event is sent to whatever view is accepting mouse clicks at that location. If that view doesn't handle the event, then the event propagates up the control hierarchy until it reaches the content view and your handler. There's no opportunity for the direct object to be changed to refer to the current event target, though. The direct object always remains the original view that received the event.

You should probably always get the direct object from the event, get the mouse location, and use HIPointConvert or HIViewConvertPoint to convert the mouse location from the direct object view to your view (or to global coordinates).

-eric

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Contextual menu and compositing window (From: Chinh Nguyen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.