Re: _NSGetCarbonMenu useage
Re: _NSGetCarbonMenu useage
- Subject: Re: _NSGetCarbonMenu useage
- From: Eric Schlegel <email@hidden>
- Date: Wed, 4 May 2005 15:17:15 -0700
On May 4, 2005, at 2:56 PM, Luc Vandal wrote:
Hi,
I just need to be notified when the mouse is over a menu item. This
doesn't seem possible with NSMenu/NSMenuItem. So I thought about
using kEventMenuTargetItem, hence the need to use Carbon menus and
use _NSGetCarbonMenu. Unless I can use kEventMenuTargetItem with
Cocoa?
I have to implement voice over items for our app. I know this is
already offered on Tiger but we're targetting 10.2 and up.
If anyone has a way to achieve this feel free to post! ;)
You actually don't need to get the MenuRef corresponding to an NSMenu
to use this Carbon event. The following should work in a Cocoa app:
- install a Carbon event handler for kEventMenuTargetItem on the
application target
- when you get the event, get the MenuRef and MenuItemIndex from the
event
- copy the menu item text from the menu with CopyMenuItemTextAsCFString
- speak the menu item text however you like
The TargetItem event is propagated to the application event target
after it has been sent to the menu that is open, so you don't need to
install your handler on the specific menu; you can just install it on
the application target.
-eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden