Re: outlineView:dataCellForTableColumn:item: repeated called w null tableColumn on Snow Leopard
Re: outlineView:dataCellForTableColumn:item: repeated called w null tableColumn on Snow Leopard
- Subject: Re: outlineView:dataCellForTableColumn:item: repeated called w null tableColumn on Snow Leopard
- From: David Melgar <email@hidden>
- Date: Fri, 28 Aug 2009 20:31:59 -0400
On Aug 28, 2009, at 6:13 PM, Corbin Dunn wrote:
On Aug 28, 2009, at 3:07 PM, David Melgar wrote:
I printed out all the calls.
What happening is:
1. My data source/delegate/controller initWithCoder method is
invoked. But its pointer to the document is not valid yet so it
doesn't have data.
2. outlineView:numberOfChildrenOfItem: method is invoked. It cannot
access the document and returns 0.
That's fine.
3. awakeFromNib is called. The root object (document) is now correct.
It doesn't seem correct that the view is asking for
numberOfChildren before awakeFromNib was called.
You are right, but some applications depend on this behavior, and
eventually we may change it (it isn't a cut and dry thing to
change). Returning 0 base on your root object not being available is
the correct thing do to, and calling -reloadData inside awakeFromNib
is a good idea (but shouldn't be required).
Thank you!! Just the workaround I needed. Calling [view reloadData] in
awakeFromNib appears to have fixed it. I've tried it a mess of times
and it's never failed. In my debug output I still see a bunch of calls
in a row to dataCellForTableColumn with a null tableColumn, but then
reloadData is called and a proper set of methods are invoked against
my data source and delegate.
I was not calling reloadData in Leopard and had never had an issue
with it.
4. A series of calls to outlineView:dataCellForTableColumn:item:
where tableColumn is passing in nil. I return nil.
It should call you once with nil, and once again with the
tableColumn non-nil, provided you returned nil the first time.
Unfortunately, there isn't enough info to really gather what is
wrong. I would suggest simplifying things to narrow down the
problem. If you think it is a bug in AppKit, please do log a bug
report. Ideally, if you can, include a sample application that
reproduces the problem.
For a sample application, do they need source or is a binary sufficient?
I have run into two other apparent Snow Leopard bugs, so I guess I
need to figure out the process. :)
Things I suggest looking at:
1. Do you subclass NSTableView? If so, try removing that subclass.
I am using NSOutlineView and not subclassing it.
2. Does it work if you remove the
outlineView:dataCellForTableColumn:item method entirely and use the
regular cell in the table column?
Interestingly, even commenting out dataCellForTableColumn, it still
fails. I end up with no calls to the datasource/delegate other than
the initial numberOfChildren call. It results in an empty NSOutlineView.
-corbin
Thanks again!!
If that is appropriate, how can I insure that I have valid data
before awakeFromNib is called?
If it matters, I'm running a 32bit build.
Thanks
On Aug 28, 2009, at 3:45 PM, Corbin Dunn wrote:
On Aug 28, 2009, at 11:58 AM, David Melgar wrote:
Running into a problem getting my application to run under Snow
Leopard.
In this case I have an outline view with a data source. The
method, outlineView:dataCellForTableColumn:item: is being
repeated called on my delegate with a null tableColumn, not just
the first time as the documentation states. The code returns
different cells based on the column, but its never passed the
tableColumn.
I haven't heard of this problem. Try printing out all calls to the
method (include parameters), and printing out what you are
returning each time.
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden