• 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: does NSMenuItem setMixedStateImage or setOnStateImage work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: does NSMenuItem setMixedStateImage or setOnStateImage work? (From: Camillo Lugaresi <email@hidden>)

  • Prev by Date: NSTextView & horizontal scrolling SOLVED?
  • Next by Date: Re: How to decompress file
  • Previous by thread: Re: does NSMenuItem setMixedStateImage or setOnStateImage work?
  • Next by thread: Re: does NSMenuItem setMixedStateImage or setOnStateImage work?
  • Index(es):
    • Date
    • Thread