On Aug 28, 2009, at 5:31 PM, David Melgar wrote:


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.

For some reason, your application may be doing something early (ie: before awakefromNib) that requires the datasource methods be filled in (ie: asking for the -numberOfRows in the table, which can happen from may different methods via side effects).

Ideally, you shouldn't have to call -reloadData for a case like yours. But, a general recommendation is to always call -reloadData when the datasource model has changed.




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. :)

We usually prefer small-source code examples that illustrate the problem, but I realize that can sometimes be difficult to provide, so access to a binary is also acceptable. The latter takes longer to debug.

http://bugreporter.apple.com

--corbin



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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to