• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: kEventParamMenuRef (was: _NSGetCarbonMenu)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kEventParamMenuRef (was: _NSGetCarbonMenu)


  • Subject: Re: kEventParamMenuRef (was: _NSGetCarbonMenu)
  • From: Luc Vandal <email@hidden>
  • Date: Wed, 04 May 2005 21:57:57 -0400

One thing though... I'm able to get the item index but I can't seem to be able to get a MenuRef.

MenuRef ref;
error = GetEventParameter( event, kEventParamMenuRef,
typeMenuRef, NULL, sizeof(MenuRef), NULL, &ref );


I get an -9870 error The piece of data you are requesting from an event is not present.


Is there any other information I could use? The item index by itself cannot be very useful!

Thanks!

Luc


On 4-May-05, at 6:17 PM, Eric Schlegel wrote:

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

  • Follow-Ups:
    • Re: kEventParamMenuRef (was: _NSGetCarbonMenu)
      • From: Ricky Sharp <email@hidden>
References: 
 >_NSGetCarbonMenu useage (From: Luc Vandal <email@hidden>)
 >Re: _NSGetCarbonMenu useage (From: Shawn Erickson <email@hidden>)
 >Re: _NSGetCarbonMenu useage (From: Luc Vandal <email@hidden>)
 >Re: _NSGetCarbonMenu useage (From: Ricky Sharp <email@hidden>)
 >Re: _NSGetCarbonMenu useage (From: Luc Vandal <email@hidden>)
 >Re: _NSGetCarbonMenu useage (From: Eric Schlegel <email@hidden>)

  • Prev by Date: Re: NSTextView - text wrapping
  • Next by Date: launchd chokes on .plist
  • Previous by thread: Re: _NSGetCarbonMenu useage
  • Next by thread: Re: kEventParamMenuRef (was: _NSGetCarbonMenu)
  • Index(es):
    • Date
    • Thread