Re: Core Data bindings: add entity to relationship
Re: Core Data bindings: add entity to relationship
- Subject: Re: Core Data bindings: add entity to relationship
- From: James Maxwell <email@hidden>
- Date: Mon, 9 Aug 2010 12:31:13 -0700
Yes, you're right. The Content for the menu is bound to [Articulations_controller arrangedObjects], and Content Values is bound to [Articulations_controller arrangedObjects].name. This works as expected, in that I see the correct set of choices (Articulations_controller manages all the stored articulations, not the assigned ones).
In terms of the popup, I'm not binding to the cell directly, but rather to the table column -- could that be the problem? I'm binding the Selected Value to [AssignedArticulations_controller arrangedObjects].articulation.name. And that just reverts to "No Value". I tried binding the column to Selected Object [AssignedArticulations_controller arrangedObjects].articulation and this at least **appeared** to work, since the chosen articulation stuck in the menu. But when I ran the assignment in the app it crashed on Articulation valueUndefinedForKey "name", which seemed a bit weird.
So, I haven't been binding the cell itself. I've been under the impression that it's the column that gets bound, not the cell -- so, yes, I meant "Selected Value"...
J.
On 2010-08-09, at 12:16 PM, Quincey Morris wrote:
> On Aug 9, 2010, at 11:47, James Maxwell wrote:
>
>> The other mistake in my original description is that the Value of the pop-up is bound to [AssignedArticulation_controller arrangedObjects].articulation.name (i.e., not "selection"), which does seem correct, since we don't know the selection yet... (I also tried binding it to the Index, rather than the Value, and this seemed a little closer, since it got rid of "No Value", and actually listed one of the created articulations. But I'm guessing this is just because the default index is assumed to be zero.)
>
> This doesn't sound right. NSPopUpButtonCell doesn't have a "Value" binding. Do you mean "selectedValue"?
>
> NSPopupButton/Cell is hard to configure by bindings simply because you have to very carefully keep track of the correct binding to use. There's content, contentValues and contentObject. And selectedIndex, selectedValue and selectedObject. Using some of the bindings affects the validity of others.
>
> Also, consider what [AssignedArticulation_controller arrangedObjects].articulation.name means. [AssignedArticulation_controller arrangedObjects] is an array, so sending the 'articulation' message to it returns (because of NSArray behavior, nothing directly to do with KVO or bindings) an array containing the result of sending 'articulation' to each of its members. Sending that the 'name' message returns an array of the names of the Articulation objects in it.
>
> That is, it builds a list of names of Articulations that have already been assigned -- likely an empty list when your application starts.
>
> It seems like the content of the menu from which articulations are chosen needs needs to be an array of Articulation.name strings, and has nothing to do with AssignedArticulation.articulation, unless you're doing something a whole lot more obscure.
>
>
> _______________________________________________
>
> 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
James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
email@hidden
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