Carbon menu with Cocoa?
Carbon menu with Cocoa?
- Subject: Carbon menu with Cocoa?
- From: Luc Vandal <email@hidden>
- Date: Tue, 03 May 2005 17:02:22 -0400
Hi,
it seems that I need to use Carbon menus in my Cocoa app because I need to get some events, such as kEventMenuTargetItem. I'm pretty much a newbie at Cocoa so I really don't know where to look to learn how to implement a Carbon menu with Cocoa. Or, another option is to hack NSMenu/NSMenuItem to get a hold of the Carbon menu underneath.
Basically, it's for the app's main menu.
If anyone has some tips about how to do this it would be very appreciated!
Thanks!
Luc
I don't think you can do this with NSMenu or NSMenuItem. As I usually say when somebody asks to do "stunts" with menus: use Carbon menus. You can either use a hack to get at the Carbon menu that is underlying the NSMenu in Cocoa, or if you're using the menu as a popup, it might be better to use a Carbon menu natively.
In my "Cocoa" menu bar utility, FastScripts, I use Carbon menus exclusively, precisely because I needed to do these kinds of "stunts."
While you're tracking user selection of a Carbon menu, you can ask for and receive "kEventMenuTargetItem" events, which tell you when the mouse has entered a menu item. There are many other events you can register for, and you can customize the contents of the menus and/or menu items to an extreme degree.
It would be nice if Apple publicized access to the underlying carbon menu for NSMenu. Since they abandoned the "cell based" implementation in favor of the Carbon wrapper implementation, developers are stuck in between without access to the compelling features of either approach.
Daniel
On Feb 10, 2005, at 1:39 PM, Luc Vandal wrote:
Hi!
I need to perform an action when the mouse is over a menu item. Is there a way to get notified about that event?
Thanks!
_______________________________________________
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
_______________________________________________
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 _______________________________________________
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