Re: Stuck on NSTreeController bindings
Re: Stuck on NSTreeController bindings
- Subject: Re: Stuck on NSTreeController bindings
- From: Jenny M <email@hidden>
- Date: Wed, 24 Feb 2010 16:54:29 -0800
Hi Mark,
Well, the Alpha is in an NSArrayController. There's a dropdown that selects
the proper Alpha. The Beta, right now, is just a pass-through to the Deltas,
maybe I shouldn't have it, but in terms of the real-life objects, it needs
to be there. So there's a popup box for Alphas, then I want all the Deltas
to appear below it in an NSOutlineView. The deltas are the ones that have
sub-items, so they're the ones I need the outline view (triangle twirls)
for.
Right, I too am not sure I can do it in bindings, partly because I think the
Entities return a Set and the Tree Controller might be expecting an Array.
(Or vice versa, not sure.) So I will try to do it in code. But how can I
code it? Where can I call the method when the Alpha is selected, is there a
binding that I can connect a method to some sort of onChange for the Alpha
array controller?
I suppose if I can't connect an onChange, I can hook it up to a button. To
test, I'll set up a button to call a method for setContent and try to reload
the outline view. I'll report back with findings... thanks for the tips!!
Jenny
On Wed, Feb 24, 2010 at 1:17 PM, Mark Townsend <email@hidden> wrote:
> Jenny,
>
> So, how are the Alphas and Betas displayed? Are they in
> NSArrayControllers?
>
> What does your UI look like?
>
> What do you want your root nodes to be? Deltas or Betas?
>
> What you might try is when you select the Alpha, call setContent: on
> NSTreeController passing in the Alpha.Beta.Deltas array, then reload the
> outlineview. Take the the binding for the tree controller though. I think
> that the way that you have your model set up it won't work through
> bindings. But I'm not totally sure.
>
>
> ---
> Mark Townsend
> http://www.markltownsend.com
>
>
> On Wed, Feb 24, 2010 at 12:01 PM, Jenny M <email@hidden> wrote:
>
>> Hi Mark,
>>
>> Thanks so much for the tip, unfortunately that's not the case. The Delta's
>> parent/children relationships point to fellow Deltas. It has a different
>> relationship (a "beta") that points to the beta. The entities aren't
>> inherited from one another, they're just chained together. Each Alpha has a
>> Beta and each Beta has multiple Deltas, but not as parent/children. The
>> Deltas have parent/children of each other - those are the entities I'm
>> trying to display in an outline view.
>>
>> My confusion comes from where to set the set of Deltas. I know the
>> currently selected Alpha, so I should be able to use that to chain down to
>> the Deltas. But every Tree Controller example I've seen just uses the
>> predicate to display ALL the objects of an entity... so I'm trying to set it
>> in the bindings and coming up empty... :/
>>
>> Jenny
>>
>>
>>
>>
>>
>> On Wed, Feb 24, 2010 at 11:16 AM, Mark Townsend <email@hidden>wrote:
>>
>>> Jenny,
>>>
>>> I think what you want is to set the Entity on the NSTreeController to be
>>> the Alpha entity, not Delta.
>>>
>>> The predicate 'parent == nil' will only give you back Delta objects where
>>> parent == nil. From what you've said, this will never be true as the Alpha
>>> objects are your top level objects.
>>>
>>> Alpha (parent == nil)
>>> |
>>> |->Beta (parent == Alpha)
>>> |
>>> |->Delta (parent == Beta)
>>> |->Delta (parent == Beta)
>>>
>>> ---
>>> Mark Townsend
>>> http://www.markltownsend.com
>>>
>>>
>>> On Wed, Feb 17, 2010 at 7:38 PM, Jenny M <email@hidden> wrote:
>>>
>>>> Sorry, realizing that the object chain isn't quite right. The Alpha-
>>>> Beta relationship is one to one, NOT many to one. Each alpha has one
>>>> beta, and one beta has multiple deltas. (I have multiple alpha
>>>> objects, hence my initial comment of multiple, but the relationship is
>>>> one-to-one.)
>>>>
>>>>
>>>> On Feb 17, 7:22 pm, Jenny M <email@hidden> wrote:
>>>> > My objects are chained like:
>>>> > Alpha (multiple) -> Beta (one) -> Delta (multiple) (delta has
>>>> > references to itself via parent and children relationships)
>>>> _______________________________________________
>>>>
>>>> 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
>>>>
>>>
>>>
>>
>
_______________________________________________
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