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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to