Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView, its data source, and their document.




On 9 jun 2005, at 07.08, Francis Derive wrote:

An NSDocument object has an NSTableview IBOutlet.
The data source of the NSTableView outlet is another object - an NSObject object.
The NSObject object implements the data source methods - say tableView:(NSTableView *)setObjectValue:(id) forTableColumn: (NSTableColumn *) row:(int).
In the implementation of this data source method, I can easily refer to the NSTableView object which comes as a parameter, but how can I refer to the NSDocument object of which the NSTableView object is an outlet ?
This is in order to be able to say to the NSDocument object that is has been edited - through the data source method tableView:setObjectValue:forTableColumn:row: - by doing something like [theDocumentObject updateChangeCount:NSChangeDone].

If you have a NSWindowController that is the delegate of the window in which the table view resides, you can probably do something like this:


MyDocument *d = [[[theTableView window] delegate] document];

Another way is of course to have a reference from the table view data source to the document itself. It would probably make sense in most implementations.

j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >NSTableView, its data source, and their document. (From: Francis Derive <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.