Re: Setting image one pulldown popup button

Matt Neuburg <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <C743D10A.4F9C3%[email protected]>
On Mon, 7 Dec 2009 18:57:54 +0100, Christiaan Hofman <[email protected]>
said:
>> Well, as I said, it works for me. I made a project containing this code.
>> This is the project's ONLY code. And I see the image and no border:
>
> I already explained in my previous email. The size is important, and note that
> (17,10) is the size of the Overflow image I'm using. This makes NSPopUpButton
> useless in practice for of borderless pulldowns (e.g. Mail's mailbox action
> button). 

Well, okay, fine. But now you are moving the goalposts. Your original
question was:

>> After trying long and many times, I am unable to set the image on a pulldown
>> NSPopUpButton in code (it works in IB).
>> 
>> I am aware that -setImage: does nothing. According to the docs, the image is
>> taken from the first menu item, so I set the image on the item at index 0. I
>> also played with other settings (in particular image position NSImageOnly and
>> unbordered) but that has no effect. Also the order in which I set the image,
>> add the menu item, set pullsdown, etc does not seem to make any effect.
>> Neither does calling sycnhronizeTitleAndSelectedItem (though that should not
>> be relevant anyway). I never see the image.
>> 
>> So does anyone know what I need to do to get the image in a popup?

I answered that question: Apple does (the MenuMadness example), I do (the
above), and now you do. There may be a lower limit to how small an
NSPopUpButton can be and still have an image, but that is a different
matter.

> Moreover, though it works in 10.6.2, it does not in some earlier version (I
> don't remember if it was 10.6.1 or 10.6.0).

I can't confirm that, since, like most users who use Snow Leopard, I am
using 10.6.2. m.

-- 
matt neuburg, phd = [email protected], <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.