Re: Adding table columns with image cells - the problem
Re: Adding table columns with image cells - the problem
- Subject: Re: Adding table columns with image cells - the problem
- From: James Chen <email@hidden>
- Date: Fri, 23 Apr 2004 09:47:37 +0800
Hi,
I think maybe you passed a nil value as parameter causing following
message. (In my practice)
>
-[NSCFDictionary setObject:forKey:]: attempt to insert nil value
Maybe you could figure out which line of code produce this message by
tracing it.
Then check each parameter you passed if it is valid or not.
HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Apr 22, 2004, at 7:18 PM, Dragan MiliD wrote:
>
Hello everyone.
>
>
I have this problem, that I'm not able to solve by myself. Let's
>
suppose I have two action methods for addition of non-existing and
>
removal of existing table columns of two different kind to/from the
>
table view. The methods are invoked with appropriate menu item on the
>
main menu. Let's see the example code:
>
>
- (void)addRemoveImageCellColumn:(id)sender
>
{
>
NSTableColumn *tableColumn =
>
[[self someTableView] tableColumnWithIdentifier:@"someIdentifier"];
>
if (tableColumn) {
>
[[self someTableView] removeTableColumn:tableColumn];
>
}
>
else {
>
tableColumn = [[NSTableColumn alloc]
>
initWithIdentifier:@"someIdentifier"];
>
NSImageCell *imageCell = [[NSImageCell alloc] initImageCell:
>
[[[NSImage alloc] initWithSize:NSMakeSize(10.0, 10.0)]
>
autorelease]];
>
NSTableHeaderCell *headerCell= [[NSTableHeaderCell alloc]
>
initImageCell:
>
[NSImage imageNamed:@"someHeaderImage"]];
>
[tableColumn setEditable:NO];
>
[tableColumn setWidth:20.0];
>
[tableColumn setResizable:NO];
>
[tableColumn setDataCell:imageCell];
>
[tableColumn setHeaderCell:headerCell];
>
[[self someTableView] addTableColumn:tableColumn];
>
[imageCell release];
>
[headerCell release];
>
[tableColumn release];
>
}
>
}
>
>
>
- (void)addRemoveTextCellColumn:(id)sender
>
{
>
NSTableColumn *tableColumn =
>
[[self someTableView] tableColumnWithIdentifier:@"otherIdentifier"];
>
if (tableColumn) {
>
[[self someTableView] removeTableColumn:tableColumn];
>
}
>
else {
>
tableColumn = [[NSTableColumn alloc]
>
initWithIdentifier:@"otherIdentifier"];
>
[tableColumn setEditable:NO];
>
[tableColumn setMinWidth:30.0];
>
[tableColumn setWidth:60.0];
>
[tableColumn setMaxWidth:200.0];
>
[tableColumn setResizable:YES];
>
[tableColumn setDataCell:[[[NSTextFieldCell alloc] initTextCell:@""]
>
autorelease]];
>
[newTableColumn setHeaderCell:[[[NSTableHeaderCell alloc]
>
initTextCell:
>
@"someTitle] autorelease]];
>
[[self someTableView] addTableColumn:tableColumn];
>
[tableColumn release];
>
}
>
}
>
>
Removing any of these two kinds of table columns from the table view
>
works fine. Adding new table column with text field cells also works
>
fine; the column appears on the right end of the table view. But, if I
>
try to add new table column with image cells, nothing happens with the
>
table view. However, menu item that invoked the action method remains
>
selected, while console log in Xcode reports:
>
>
-[NSCFDictionary setObject:forKey:]: attempt to insert nil value
>
>
Now, if I try to remove some table column (with menu item remained
>
selected) nothing happens, Xcode gives the same report. Things go back
>
to "normal" only if I add new table column with text field cells. As
>
soon as I do that, two table columns appear in the table: the one (with
>
text field cells) that I've just added at the right end of the table
>
view, and the previous one (with image cells) that didn't appear when
>
it should have, on the second place to the right end of the table view.
>
>
What did I do wrong? I've tried really hard to trace this behavior
>
(should I call it bug of mine) in GDB and all of my code executes fine,
>
the report mentioned above appears when the program enters chain of
>
internal Cocoa calls that I cannot (or don't know how to) trace.
>
>
This isn't serious issue, but might be quite annoying to the users of
>
my program.
>
>
Regards,
>
>
Milke.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.