|
From: | Fred Kiefer |
Subject: | Re: Once again the NSOutlineView |
Date: | Sat, 14 Feb 2004 14:11:51 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821 |
Andreas Heppel wrote:
I have again stumbled across some strange behaviour in NSOutlineView. This time it has to do with reloading items. The method -reloadItem:reloadChildren is using another method called _findItem:childIndex:ofParent:. I suppose that this method is intended to return the parent and the index relative to this parent of the given item. Unfortunately, it is not, as the parameter 'parent' is not by reference. Furthermore, -reloadItem:reloadChildren does not update NSOutlineView's data structures _items and _levelOfItems, which leads to some more starnge behaviour in the case that the NSOutlineView's delegate does not simply return a changed item, but a new one. Maybe, this behaviour is intended, as the delegate is supposed to return the same, but changed item. However, fixing this is not difficult imho, thus, I'd prefer to change this behaviour. Attached is patch with a fix, containg a couple of detailed comments on what I did.
I did (hopefully) resolve this problem in a different way, by removing the helper method and inlining the code into reloadItem:reloadChildren:. This allowed for a few more corrections/simplifications (and would allow for more, if I only would understand better, what this method should do). I must admit, that NSOutlineView is a part of GUI, where I don't understand most of the code. No idea, for example, why it replaces the item with NULL, if it is nil.
Perhaps you may want to take over the maintainance this class? Fred
[Prev in Thread] | Current Thread | [Next in Thread] |