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 11:47:07 -0700
Thanks Quincy,
But looking at the IB file, I've noticed that it already is a NSPopUpButtonCell, not a combo -- I got it wrong in my question, sorry.
However, your description of my mistake sounds right; i.e., that I'm trying to change the name rather than assign the relationship.
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.)
I got this design from a Core Data book, though it doesn't seem to work in the sample project from the book either, so I wish I hadn't used it. (Interestingly, that code does use a ComboBox, but switching it to a popup didn't fix it there either.) Mind you, the design does seem totally logical, to me, so I'm not sure how I would do it differently... How should I assign an entity to the relationship of another entity?
The way I pictured it working was that the user builds an array of Articulation entities in one window/tab (which works). Then, in a second window/tab, s/he clicks one of the listed instruments in the left table, and then clicks the "+" at the bottom of the right table to create a new articulation mapping. This adds an object to the AssignedArticulation entity's articulations relationship - this is an Articulation entity. Picking a name from the popup then chooses the assigned articulation by name.
Seems reasonable...
J.
On 2010-08-09, at 10:05 AM, Quincey Morris wrote:
> On Aug 9, 2010, at 08:52, James Maxwell wrote:
>
>> I have a window with two tables: one showing the available instruments, and one for adding articulations to the selected instrument. The selection in the first table is bound to the [MnS_Instrument_Controller arrangedObjects].name, so that clicking a name selects a particular MnS_Instrument. The second table uses combo boxes for choosing which articulation to add; "+" and "-" buttons below the table are bound to the add: and remove: methods of AssignedArticulation_Controller. The available articulations, listed as choices in the combo boxes, are supplied by Articulation_controller, and they show up as expected. The value of the table selection is bound to [AssignedArticulation_Controller selection].articulation.name, the idea being that the AssignedArticulation will grab a named articulation from the set of stored Articulations, and assign it to the instrument. But when I release the combo box, it reverts back to "No Value" and won't make the assignment.
>>
>> Any ideas?
>
> Yup. (I need to make this response a macro, I think.)
>
> A combo box is a kind of text field, not a kind of menu, so it's the wrong control to use in the circumstances described above. What you're doing by making a "choice" from the combo box is trying to change the Articulation.name string property, *not* the AssignedArticulation.articulation relationship.
>
> Use a menu or a NSPopUpButton in your interface, instead of NSComboBox.
>
>
> _______________________________________________
>
> 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