Re: NSOutlineView Travails
Re: NSOutlineView Travails
- Subject: Re: NSOutlineView Travails
- From: Gordon Apple <email@hidden>
- Date: Wed, 17 Apr 2013 20:08:46 -0500
- Thread-topic: NSOutlineView Travails
By now, I¹m sure you¹ve seen my second posting. That at least got things
showing up in (mostly) the right place. We always had a mixture of bindings
and data source, mainly because line numbers were hard to do with bindings.
With view=based tables and a little subclassing, it¹s not so hard. For
tables, you need the data source because if gives you the item and you can
get rowFromItem and feed it back to it (offset by 1). Things are still not
right. Our outlineView is not stable and it sometimes edits the wrong row.
We want to add a hoverView to show popovers (works for tables), but we need
the basics working predictably first.
On 4/17/13 4:09 PM, "Quincey Morris" <email@hidden>
wrote:
> On Apr 17, 2013, at 10:50 , Gordon Apple <email@hidden> wrote:
>
>> We are converting tables and outlines to view-based. So far, so good, on
>> tables. But NSOutlineView has been a pain. First of all, there is no
>> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
>> Reference. You have to rely on sample code and NSOutlineView.h.
>
> Yup, the documentation situation for NSOutlineView is awful.
>
>> Our outline view has a column/cell identifier ³LineNumber², one for
>> ³CheckBox², one for ³Outline². Previously, the latter two were bound to our
>> NSTreeController. Converting to views (yes, using
>> outlineView:viewForTableColumn:item:), we could not even get the nib to
>> load. ObjectValue always came up nil. We tried binding the tableView to
>> the tree controller still nil.
>
> You can't "try" binding here. If you're using a data source, you don't bind
> the outline view to the tree controller, and in that case you need to set
> view.objectValue to the desired object before returning from
> 'outlineView:viewForTableColumn:item:'.
>
> Otherwise, you *must* bind the outline view's "content" binding to the tree
> controller, and the outline view should then maintain "objectValue" for you.
> (But since I always use data sources these days, I can't swear that this is
> precisely correct.)
>
>> Ok, after examining sample code, we
>> decided that just maybe there was something magic about the column/cell
>> identifier ³MainCell², so we changed our third column/cell identifier and
>> replaced @²Outline² with @²MainCell² in our code. Amazing now the nib
>> loads. However, still no values.
>
> Since you're talking about loading nibs, I assume you've got code to register
> the nib, and I bet you forgot to ensure that the nib is registered with with
> the identifier that matches what you're actually using.
>
> If I remember the details correctly, you're going to invoke
> 'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'.
> When you're using registered nibs, you must use the identifier that the nib is
> registered under, and the identifier assigned to the built-in cell view (that
> you're not using) is irrelevant. When you're using the built-in cell view, you
> must use its identifier, of course.
>
> The column identifier is basically unrelated, unless you *choose* to configure
> it to match the actual cell view identifier. The table view documentation
> assumes this is desirable, but I've never found it makes anything much easier.
> All it does is provide the opportunity for things to get out of sync, as you
> discovered.
>
>> Even worse, the turn-down dingy appears
>> in the first column, not the third where we want it. It does turn down the
>> right number of times and depths to match our outline, but is in the wrong
>> place and no values.
>>
>> So how do I get the outline back into the third column and get my
>> objectValues to work?
>
> Are you sure you aren't inadvertently returning a group row view, or a
> full-row view?
>
>
--
Gordon Apple
Ed4U
Little Rock, AR
_______________________________________________
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