• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Beginner Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Beginner Question
      • From: Nicholas Riley <email@hidden>
  • Prev by Date: Re: Cocoa Books (was New to Cocoa)
  • Next by Date: Re: Cocoa Books (was New to Cocoa)
  • Previous by thread: Re: cocoa-developers all over the place
  • Next by thread: Re: Beginner Question
  • Index(es):
    • Date
    • Thread