Re: Getting data from NSOutlineView
Re: Getting data from NSOutlineView
- Subject: Re: Getting data from NSOutlineView
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 13 Dec 2005 08:31:06 -0800
On Dec 13, 2005, at 2:46 AM, goessly wrote:
I'm looking for a way to access the values displayed in an
NSOutlineViews cells programmatically.
... in order to retrieve data from this view I've attempted the
following:
[outlineViewDelegate
objectValueForTableColumn: [outlineViewDelegate
tableColumnWithIdentifier:@"titel"]
byItem: currentItem
];
with:
id currentItem = [outlineViewDelegate itemAtRow: itemCounter];
First of all, the compiler throws the following warning:
AppController.mm:302: warning: 'NSOutlineView' may not respond to '-
objectValueForTableColumn:byItem:'
Strange enough, since NSOutlineView inherits this from NSTableView,
doesn't it?
Expected behavior. -objectValueForTableColumn:byItem:. You will
note that this method along with several others are declared in the
following construct ...
@interface NSObject(NSOutlineViewDelegate)
... which is called an "informal protocol". That is, it is just a
set of methods that are declared, but likely not implemented
anywhere. In this case, they are declared such that when you
implement them on your outline view delegate, the compiler has a
convenient means of validating the types.
In any case, you would never call one of these methods directly. If
you want a particular value at a particular spot within the outline
view, you should use NSOutlineView's API for retrieving said
information.
Or, as someone else pointed out, you should really query your
model. Relying upon the view layer to store and retrieve data will
generally lead to a fragile implementation.
b.bum
_______________________________________________
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