Re: Setting image one pulldown popup button
Matt Neuburg <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <C7418692.4F8D4%[email protected]> |
On or about 12/6/09 1:32 PM, thus spake "Christiaan Hofman" <[email protected]>: > > On Dec 6, 2009, at 21:16, Matt Neuburg wrote: > >> On or about 12/4/09 12:00 PM, thus spake "[email protected]" >> <[email protected]>: >> >>> Date: Fri, 4 Dec 2009 12:36:10 +0100 >>> From: Christiaan Hofman <[email protected]> >>> Subject: Setting image one pulldown popup button >>> >>> 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? >>> >> >> Apple's MenuMadness example does not help here? Works okay on my machine... >> Perhaps I'm not understanding what the problem is. m. >> > > I'm using essentially the same code as the sample code and it does nothing for > me: I get an empty popup button. But what happens if you use *exactly* the same code as the sample code - namely, the sample code itself? On my machine, as I said, we see the image in the pulldown menu button. So your "essentially" differs in some way from "exactly", and the difference is crucial: whatever that difference is, that's what you're doing wrong. You don't show us any code, so it could be anything - you could be getting a nil image for all I know. But my point is, the fact that you have working sample code gives you a place to start figuring out what the mistake is. m. -- matt neuburg, phd = [email protected], http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring & Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com