[Q] am I allowed to call NSTableDataSource informal protocol methods myself?
[Q] am I allowed to call NSTableDataSource informal protocol methods myself?
- Subject: [Q] am I allowed to call NSTableDataSource informal protocol methods myself?
- From: "Peter.Teeson" <email@hidden>
- Date: Thu, 29 Apr 2004 11:19:31 -0400
On Apr 27, 2004, at 18:12, Bill Cheeseman wrote:
<snip>
>
We all tend to speak loosely of the "datasource" as the repository of
>
the
>
data (indeed, we usually put the data and the protocol methods in the
>
same
>
class), but in fact the datasource is only the vehicle through which
>
we get
>
the data. That is, it is the "source" of the data in another sense of
>
the
>
word "source" -- more like a broker than a dealer, you might say.
<snip>
Well there is something lacking in my understanding so back to this
helpful group.
First off apart from this issue the app works as designed; the
tableView is drawn as desired.
In my data model class I have the following:
@interface PasswordsDataSource : NSObject{
NSMutableArray *passwordRecs; // Mutable array of PasswordRecord
objects
}
...
@end
@interface PasswordsDataSource(NSTableDataSource) // NSTableView
informal protocol
// Data Source Methods
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- (void)tableView:(NSTableView *)tableView
setObjectValue:(id)objectValue forTableColumn:(NSTableColumn
*)tableColumn row:(int)row;
@end
MyDocument.h has the following:
@interface MyDocument : NSDocument {
PasswordsDataSource *passwordRecords;
IBOutlet NSTableView *tableView;
IBOutlet NSButton *deleteButton;
}
....
@end
and MyDocument.m init is the following:
- (id)init {
self = [super init];
if (self) {
passwordRecords = [[PasswordsDataSource alloc] init]; // storage for
our table source data
}
return self;
}
then in one of the methods I would like to get the contents of a cell
so I thought to send the following message:
tempDelimitedString = [passwordRecords
objectValueForTableColumn:[tableView
tableColumnWithIdentifier:@"macAddress"]:[tableView selectedRow]];
But I get the following Warnings when building:
MyDocument.m:130: `PasswordsDataSource' may not respond to
`-objectValueForTableColumn::'
MyDocument.m:130: cannot find method `-objectValueForTableColumn::';
return type `id' assumed
Guess I don't understand why I am not able to invoke the category
method (a.k.a. informal protocol method).
And yet NSTableView is indeed calling the implemented
objectValueForTableColumn (looks like from drawRect method).
Any suggestions as to what is or is not going on here?
TIA for your comments....
respect....
Peter
_______________________________________________
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.