• 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
ImageAndTextCell rendering weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ImageAndTextCell rendering weirdness


  • Subject: ImageAndTextCell rendering weirdness
  • From: Andrew Shamel <email@hidden>
  • Date: Sat, 17 Jan 2009 10:26:28 -0800

Greetings Cocoa-Dev!

I am having the hardest time with a persistent and strange error with Apple's ImageAndTextCell in my NSOutlineView.

I have the ImageAndTextCell set to be the outline's data cell via NSTableColumn's -setDataCell: method, and I set the image of the cell in the outlineView's delegate, using - (void)outlineView:willDisplayCell:forTableColumn:item: And here's where the trouble starts.

The problem I am encountering is this: When I have an image set in the cell, and I go to edit the text of the *first* item in any particular set of children, after the first keystroke, the text field goes haywire, turning white, with the text appearing only as shadow lines, and editing stops. If I click off the cell, the mess goes away, the one keystroke's worth of edit remains, but does not get noticed by the bindings.

Here is a picture of what happens: http://www.pileofdebris.com/editError.png

Does anyone have any thoughts about why this might be happening? I've figured out that if my willDisplayCell: delegate method is empty, this does not happen. Here is the code for that method, should it be of any help.

- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: (id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
NSManagedObject *node = [item representedObject];
NSString *type = [node valueForKey:@"type"];
NSString *tag = [node valueForKey:@"tag"];

if ([type isEqual:@"collection"]) {
[cell setImage:[self defaultFolderImage]];
} else if ([type isEqual:@"library"]) {
if ([tag isEqual:@"booksLibrary"]) {
[cell setImage:[self booksLibraryImage]];
} else if ([tag isEqual:@"articlesLibrary"]) {
[cell setImage:[self articlesLibraryImage]];
} else {
[cell setImage:[self articlesLibraryImage]];
}
} else if ([type isEqual:@"section"]) {
[cell setImage:nil];
[cell setEditable:NO];
[cell setSelectable:NO];
} else if ([type isEqual:@"smartCollection"]) {
[cell setImage:[self smartFolderImage]];

}
}


Thanks so much for any input people can offer.

pax,

Andy S.
_______________________________________________

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: ImageAndTextCell rendering weirdness
      • From: Sandy McGuffog <email@hidden>
  • Prev by Date: Sample Code from WWDC 2008?
  • Next by Date: Re: ImageAndTextCell rendering weirdness
  • Previous by thread: Re: Sample Code from WWDC 2008?
  • Next by thread: Re: ImageAndTextCell rendering weirdness
  • Index(es):
    • Date
    • Thread