Re: does NSMenuItem setMixedStateImage or setOnStateImage work?
Re: does NSMenuItem setMixedStateImage or setOnStateImage work?
- Subject: Re: does NSMenuItem setMixedStateImage or setOnStateImage work?
- From: Kurt Bigler <email@hidden>
- Date: Thu, 19 Jan 2006 12:50:38 -0800
on 1/19/06 4:24 AM, Camillo Lugaresi <email@hidden> wrote:
> On 19/gen/06, at 08:43, Kurt Bigler wrote:
>
>> The question this brings up for me: if it's true that Cocoa menus
>> are a
>> layer on top of Carbon menus, then is there a way to bridge into
>> carbon in
>> order to get some other menu item mark (character) alternatives to
>> work
>> around this (apparent) Cocoa bug?
>
> Yes, but you have to use the undocumented function _NSGetCarbonMenu.
> There are some caveats, such as the fact that NSMenu does not create
> a MenuRef until the menu is put in the menubar or used as a popup
> menu for the first time, so you might have to force this (search the
> web or the archives of this list for more information). However, once
> you have the MenuRef you should definitely be able to do what you want.
Thanks.
I guess "undocumented" also means not in the headers--at least I couldn't
find it. So I had to include the following in my .mm source:
extern "C" {
MenuRef _NSGetCarbonMenu(NSMenu* aMenu);
}
If there is something "cleaner" please let me know.
The extern "C" was necessary for linking. Apparently C++ linkage is the
default for .mm files, a subtlety of Objective-C++ that I don't remember
reading about.
-Kurt
_______________________________________________
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