Re: NSTableView delegate not getting called
Re: NSTableView delegate not getting called
- Subject: Re: NSTableView delegate not getting called
- From: "Louis C. Sacha" <email@hidden>
- Date: Tue, 13 Jul 2004 21:16:17 -0700
Hello...
Well, part of the reason why this might be a bit confusing is that
NSOutlineView is somewhat "special".
NSOutlineView is technically a subclass of NSTableView, but the
functionality of the two classes is different enough that many of the
things you might normally expect of a subclass (particularly
regarding the delegate and datasource methods) don't really apply.
In general, the delegate methods that a class uses are inherited by
subclasses, in the sense that the delegate methods used are part of
the implementation of the class that is inherited and used by the
subclass unless overridden.
For example, if you create a subclass of NSWindow, the NSWindow
implementation of performClose: will be inherited by your sublcass.
Since the NSWindow implementation of performClose: uses the delegate
method windowShouldClose:, your subclass will use it too unless you
have completely overridden the performClose: method in your subclass.
If you do override the performClose: method in your NSWindow
subclass, and your implementation is similar enough to the original
NSWindow implementation, you might choose to implement it in a way
that uses the same delegate method. If your implementation is
different and you need to provide more information, you might need to
create a new delegate method that requests or provides the
information relevant to your particular implementation.
Getting back to NSOutlineView and NSTableView, it all comes down to
the fact that the two are very different kinds of views. In my
opinion, NSOutlineView probably shouldn't be a subclass of
NSTableView at all, but we probably don't really need another one of
those threads. :)
Basically, since NSOutlineView is significantly different from a
table, most of the implementations of the inherited methods had to be
changed so that they made sense for an outline. Since many of the
delegate methods (and methods in the respective data source informal
protocols) needed to be changed, it probably made sense to not try to
use any of the existing NSTableView delegate methods, and instead add
new methods specific to NSOutlineView to replace them.
That way you don't need to worry about which delegate methods do or
don't apply to each class; if you are using an NSOutlineView you use
the delegate and data source methods for NSOutlineView, and if you
are using a NSTableView you use its delegate and datasource methods.
Hope that helps,
Louis
At 2:02 PM -0700 7/12/04, David Alter wrote:
I have a NSOutlineView. I have connected its delegate in IB to a
controller class. The delegate methods for the outline view gets
called just fine. Now NSOutlineView subclasses from NSTableView. So
I would expect that if I where to add the NSTableView delegate
methods to my controller class they would get called as well.
However this is not the case. My NSTableView delegate methods never
get called.
Is there something I'm neglecting to do here? Anyone have any ideas?
thank you for the help
David Alter
_______________________________________________
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.