Re: More NSBrowser/NSTreeController bugs
Re: More NSBrowser/NSTreeController bugs
- Subject: Re: More NSBrowser/NSTreeController bugs
- From: John Buckley <email@hidden>
- Date: Fri, 9 Dec 2005 14:46:33 +0000
On 12/4/05, Hamish Allan <email@hidden> wrote:
>
>
2005-12-04 13:18:18.078 BindTest[14749] -[TestTextFieldCell
>
setObjectValue:((null))(null)]
>
2005-12-04 13:18:18.080 BindTest[14749] -[TestTextFieldCell
>
setObjectValue:(NSPathStore2).DS_Store]
>
>
Apart from the inefficiency of the extra call with null argument,
>
this is fine: these are the eight objects visible in the outline
>
view. But where are the calls to -[TestBrowserCell setObjectValue:]?
>
The NSBrowser is nonetheless being populated! But what's really odd
>
is that if you browse to e.g. Applications, I get -[TestBrowserCell
>
setObjectValue:] called for every item in /Applications -- not just
>
the visible ones!
Hamish,
I've been doing some digging around with your NSBrowser bindings test
project this morning.
What I've discovered so far is:
* NSTreeController does call the correct method via KVC (as specified
in the contentValue bindings property) for the first browser column.
* However there are no TestBrowserCells allocated for this column, so
you never see the setObjectValue call in the log (instead it allocates
NSBrowserCells).
* The rest of the columns have instances of TestBrowserCell allocated
so you see the calls...
So it appears as if NSTreeController is doing its job (sort of)
correctly, it's just that for some reason the first column in the
NSBrowser isn't respecting the cell Class you specified. This is odd,
because the cells are not allocated until required, i.e. well after
you call "NSBrower -setCellClass" in your controller.
I've had experience of problems with bindings because they seem to do
setup very early on in the nib wake up process. So I thought: why not
try and set the NSBrowser's cell Class really early? I've done this by
subclassing NSBrowser and calling 'setCellClass' in its -initWithCoder
method. And amazingly this fixes the problem and I end up with
TestBrowserCells in all columns as expected.
It's not clear to me whether this is a bug in NSBrowser or
NSTreeController, but at least there is a workaround.
Perhaps in future Apple will allow editing of the NSBrowser's cell in
IB which would avoid the need to subclass.
Regards,
John
_______________________________________________
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