I have run up against an apparent 10.6.2 bug in the NSTableView object. 
Specifically, if NSTableViewSelectionHighlightStyleNone is set, the tableView 
causes Assertion failures and other problems. Below is some code demonstrating 
the problem. In any event, I need to emulate the None style for highlight in my 
TableView. Does anyone know how to set the highlight color, perhaps, to 
clearColor or something with a tiny alpha value so it approximates the None 
appearance? I can live with undocumented changes, as the program will run on a 
system with a fixed OS, and I can un-hack the NSTableView when the problem is 
repaired. (Radar ID# 7588256). If I've done something wrong and this code is 
the problem, please tell me, as I'm sort of stuck for now.
Thanks!
-Dan

Sample code: create a new Cocoa project, drag a tableView into IB, wire it to 
your controller. When you add a row, click on the header, then on the tableView 
cell. If you comment out the highlightStyle line, this aberrant behavior 
disappears. 

@implementation MArrayCont

- (void)awakeFromNib
{
        mColTitles = [[NSArray arrayWithObjects:@"One", @"Two", nil] retain];
        NSArray *mCols = [myTableView tableColumns];
        int i=0;
        for (NSTableColumn *aCol in mCols)
        {
                [aCol bind:@"value" toObject:self
           withKeyPath:[NSString stringWithFormat:@"arrangedObjects.%@", 
[mColTitles objectAtIndex:i]]
                   options:nil];
                i++;
        }
        [myTableView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone];
        
}

- (IBAction)add:(id)sender
{
        NSMutableDictionary *mNewRow = [[[NSMutableDictionary alloc] init] 
autorelease];
        int i=[[self content] count];           // Just provides some 
uniqueness to each entry.
        for (NSString *aColTitle in mColTitles)
        {
                [mNewRow setObject:[NSString stringWithFormat:@"%i: %@",i, 
aColTitle] forKey:aColTitle];
        }
        [self addObject:mNewRow];
}

- (void)dealloc
{
        [mColTitles release];
        [super dealloc];
}

@end_______________________________________________

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