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: Obtaining the screen origin of a menu?



Now I'm thinking that since we're talking about 10.3 and later support here, I should be able to get some pretty interesting information by examining the HIView associated with the menu. Probably a much less dangerous approach, too?

Daniel

On Jan 30, 2005, at 1:16 PM, Eric Schlegel wrote:


On Jan 30, 2005, at 1:12 PM, daniel wrote:

Is there any way I can find out what the screen origin is for whatever menu my user is interacting with?
I am using PopupMenuSelect with nested hierarchical menus. I can predict the screen bounds of the top-level menu because I know its height, width and origin, but for sub-menus presented on my behalf by PopupMenuSelect, I can't figure out how to get this information.
What I want to do is implement a sort of tear-off feature. I am imagining something where if the mouse leaves the menu bounds and travels a certain distance, the tear-off will occur. What I'm doing so far is listening for kEventMenuOpening/Closing messages while tracking the menu. This allows me to identify the tear-off target, and I can get the height and width of the menu, but not the origin at which it will be drawn.

On 10.3 or later, you could probably iterate over the window list, looking for windows of class 9, which is kMenuWindowClass (no constant exists for this in the public headers). Be sure to code defensively, since this is an implementation detail, and there's no guarantee we'll always use that window class, or that the windows will always be visible to you.


-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: 
 >Obtaining the screen origin of a menu? (From: daniel <email@hidden>)
 >Re: Obtaining the screen origin of a menu? (From: Eric Schlegel <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.