Beginner Question
Beginner Question
- Subject: Beginner Question
- From: Rick Frank <email@hidden>
- Date: Sun, 13 Oct 2002 14:57:55 -0400
I have a document based application with a table view. I have a dataSource
with the table view. The datasource is my document class. The document class
has a member object which is an array of data. (Sounds pretty simple).
For example, a document might look like
@interface MyDocument : NSDocument
{
NSMutableArray* myData;
}
The example code that I've seen with this kind of design have delegates for
the NSTableView. In these examples, the delegates somehow have access to the
data - that is, they seem to just have access somehow to "myData", which is
an outlet.
When I create delegates for the table view, I create them to have a "myData"
outlet, but It's nil.
How does one get the delegate to have access to "myData"?
I my previous life, I would have done something like this to get at a
document from a GUI object
MyDocument* GetDocumentForWindow(NSWindow* win)
{
NSDocumentController* docControl = [NSDocumentController
sharedDocumentController];
MyDocument* aDoc = (MyDocument*)[docControl documentForWindow:win];
return aDoc;
}
I must be misunderstanding something in how the examples work - what is the
"cocoa" way?
Thanks for any tips.
Rick
_______________________________________________
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.