• 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
Setting a shadow in -willDisplayCell causes CGContextSetStyle error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting a shadow in -willDisplayCell causes CGContextSetStyle error?


  • Subject: Setting a shadow in -willDisplayCell causes CGContextSetStyle error?
  • From: Keith Blount <email@hidden>
  • Date: Thu, 11 Oct 2007 04:05:02 -0700 (PDT)

Hi,

A couple of months ago, I posted about an apparently
benign error my app was generating on the console:

CGContextSetStyle: invalid context

(The original thread can be found here:
http://www.cocoabuilder.com/archive/message/cocoa/2007/8/24/188258)

It has had me stumped ever since, but today I *think*
I have finally found the cause. (The strange thing was
that this error only ever appeared if projects were
opened via File > Open; my app automatically opens the
last project when it is launched, and the error never
seems to occur in this circumstance so I kept missing
it - weird.)

It seems to come from the fact that I add a shadow to
the text of my NSOutlineView source list using
-outlineView:willDisplayCell:forTableColumn:item: as
follows:

- (void)outlineView:(NSOutlineView *)olv
willDisplayCell:(id)cell
	 forTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
	NSShadow *shadow = [[NSShadow alloc] init];
	[shadow setShadowOffset:NSMakeSize(0, -1.1)];
	[shadow setShadowColor:[NSColor grayColor]];
	[shadow set];
	[shadow autorelease];
}

The above code seems to cause a "CGContextSetStyle:
invalid context" console error whenever it is called
if the item is selected (which, unfortunately, is the
exact case in which I want to add a shadow in my code
- for selected items).

Can anyone see what I am doing wrong here, or why this
might be generating such an error? Is there a better
way of setting the shadow that will avoid this console
error?

Many thanks in advance,
Keith


      ____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
http://tv.yahoo.com/collections/3658
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Setting a shadow in -willDisplayCell causes CGContextSetStyle error?
      • From: "Julien Jalon" <email@hidden>
  • Prev by Date: Re: Compositing over live video examples
  • Next by Date: Re: Setting a shadow in -willDisplayCell causes CGContextSetStyle error?
  • Previous by thread: Re: THCanvasView: Finder-like Icon View
  • Next by thread: Re: Setting a shadow in -willDisplayCell causes CGContextSetStyle error?
  • Index(es):
    • Date
    • Thread