• 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: NSImage in a NSMenuItem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage in a NSMenuItem?


  • Subject: Re: NSImage in a NSMenuItem?
  • From: Olav Anderson <email@hidden>
  • Date: Wed, 6 Oct 2004 08:09:43 -0700

Hello,

In case anyone else was trying to get an image to display in the app
dock menu, you can't. Anyway, you can't using an attributed string set
to the title.

After getting images to display in menu items via attributed strings
taking the very same menu and assigning it to the app menu dock only a
little space shows up where the image should be. In addition, all the
string attributes are ignored and the text shows up generically.

This seems to be a bug in the AppKit but there must be some magical
work around because I do see images in the app dock menu when there
are multiple windows for an app a little window icon shows up.

Thanks to everyone who helped out with this.

BTW, it's pretty tricky to get the image to show up in an attributed string!

Best regards,

-o


On Thu, 30 Sep 2004 13:24:15 -0700, Olav Anderson <email@hidden> wrote:
> Greetings,
>
> [SNIP]
>
> Best regards,
>
> Olav
>
>
>
>
> On Wed, 29 Sep 2004 15:09:52 -0700, John C. Randolph <email@hidden> wrote:
> >
> >
> >
> > On Sep 29, 2004, at 2:59 PM, wURLdBook Research wrote:
> >
> > > Hi,
> > >
> > > I was trying to set a NSImage in a NSMenuItem in the DockMenu. I can't
> > > seem get it to work even though I am doing all the normal stuffl like
> > > [menutItem setImage:anImage].
> > >
> > > Is there a trick?
> >
> > On Sep 29, 2004, at 2:59 PM, wURLdBook Research wrote:
> >
> > Hi,
> >
> > I was trying to set a NSImage in a NSMenuItem in the DockMenu. I can't
> > seem get it to work even though I am doing all the normal stuffl like
> > [menutItem setImage:anImage].
> >
> > Is there a trick?
> >
> > The trick is to use an NSAttributedString with the image imbedded, and
> > set that string as the menu item's title.
> >
> > -jcr
> >
> >
> > John C. Randolph <email@hidden> (408) 974-8819
> > Sr. Cocoa Software Engineer,
> > Apple Worldwide Developer Relations
> > http://developer.apple.com/cocoa/index.html
> >
> >
>
_______________________________________________
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: NSImage in a NSMenuItem?
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: NSTextAttachment display problems on 10.2?
  • Next by Date: Re: Oracle Database Connection within a Cocoa Application
  • Previous by thread: NSTextAttachment display problems on 10.2?
  • Next by thread: Re: NSImage in a NSMenuItem?
  • Index(es):
    • Date
    • Thread