outlineview copyWithZone:
outlineview copyWithZone:
- Subject: outlineview copyWithZone:
- From: Alun ap Rhisiart <email@hidden>
- Date: Sat, 8 Jan 2005 14:49:36 +0000
I am having a problem finishing off an application, almost the last
thing I need to do is to get an outline view working properly. This
outline view can contain two kinds of items: a list of Tenders, and
clicking the disclosure mark next to a tender with show a list of
Projects (called proposals at this stage). There are a number of
columns with show some values (generally floats), and the first is a
name field. These are my outline view methods in MyDocument.m
- (int)outlineView:(NSOutlineView *)outlineView
numberOfChildrenOfItem:(id)item
{
return item ? [item numberOfChildren] : [[currentParty tenders]
count];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView
isItemExpandable:(id)item
{
return item ? [item hasChildren] : YES;
}
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index
ofItem:(id)item
{
return item ? [item childAtIndex:index] : [[currentParty
tenders]objectAtIndex:index];
}
- (id)outlineView:(NSOutlineView *)outlineView
objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
return [item performSelector: NSSelectorFromString([tableColumn
identifier])];
}
As you see I have set the column identifier to the method name than
returns the value for the column.
In Tender.m I have:
- (int)numberOfChildren
{
return [proposals count];
}
- (BOOL)hasChildren
{
return [self numberOfChildren] > 0;
}
- (Project *)childAtIndex:(int)index
{
return [proposals objectAtIndex:index];
}
Whereas in class Project these methods return 0 and NO respectively
(last method not implemented). In Tender.m the methods called by
perform selector generally look like this (using F-Script):
- (float)grossSalesRevenues
{
if ([proposals count] > 0)
return [[[@"[:proposals | proposals grossSalesRevenues \\ #+]"
asBlock]value: proposals] floatValue];
else return 0.0;
}
ie it returns the sum of the same method result from each of it's
Project objects. In the project proposals these are simple getters of
floats.
My problem is that I can see the top level of tenders okay, but when I
try to disclose the projects I get this error:
*** -[Project copyWithZone:]: selector not recognized
I don't call copyWithZone: anywhere, and haven't seen anything in the
docs or books I have suggesting that outline views need to make copies.
what is going on here? And if I really do need to enable this copying
protocol, how deep does it need to be?
Any help very much appreciated.
Alun ap Rhisiart
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden