Skip navigation.
 
mlRe: [SOLVED] PlotIconRefInContext doesn't work
FROM : Mike
DATE : Sat May 17 23:15:58 2008

Mike wrote:
> Michael Babin wrote:

>>
>> On May 17, 2008, at 10:06 AM, Michael Vannorsdel wrote:
>>

>>> I'm thinking the window might be redrawing itself right after your
>>> own drawing and erasing it.  You could try disabling the window's
>>> auto displaying and flush the window buffer after your draw to
>>> determine if this is the case.
>>>
>>> I don't know where you're doing the drawing to know if it's safe from
>>> being erased or not.
>>>
>>>
>>> On May 17, 2008, at 12:37 AM, Mike wrote:
>>>

>>>> It's a local NSRect which I assume is interchangeable with CGRect as
>>>> they are the same.
>>>>
>>>> I fill in the rect at the top of the method with the Rect of the
>>>> item in the window from IB and then I hide the item before drawing
>>>> to prevent my stuff from being drawn over.
>>>>
>>>> CGContextFillRect doesn't do anything either. Just a blank space as
>>>> with PlotIconRefInContext.

>>
>> If that were indeed the problem (some other drawing taking place after
>> his own and erasing it), an easier way to check for it would be to use
>> Quartz Debug, turn on "Autoflush drawing", set a breakpoint at the
>> CGContextFillRect call, and step over it to see if the rect is indeed
>> filled as expected.

>
> I tried adding a -display message at the end of the method which forces
> a flush, but nothing changed. This is for an about box window. One
> question I have is: do I need to subclass NSWindow and then override the
> drawing and updating methods in order to get this to work? I will give
> Quartz Debug a try. Here is the entire method:
>


I solved the problem using the IconFamily library:

http://iconfamily.sourceforge.net/

It just astounds me there is no support for icons in Cocoa.

Related mailsAuthorDate
mlRe: PlotIconRefInContext doesn't work Michael Vannorsdel May 17, 17:06
mlRe: PlotIconRefInContext doesn't work Michael Babin May 17, 17:29
mlRe: PlotIconRefInContext doesn't work Mike May 17, 22:16
mlRe: [SOLVED] PlotIconRefInContext doesn't work Mike May 17, 23:15
mlRe: [SOLVED] PlotIconRefInContext doesn't work Adam R. Maxwell May 17, 23:31
mlRe: [SOLVED] PlotIconRefInContext doesn't work Mike May 17, 23:37
mlRe: PlotIconRefInContext doesn't work Uli Kusterer May 18, 00:16
mlRe: [SOLVED] PlotIconRefInContext doesn't work Michael Vannorsdel May 18, 00:46