small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
06 Aug 2010, 16:19
James Maxwell (5 posts)

Forgive me if this has already been mentioned – I couldn’t find it on the forum. When I run the v3 of recipes I can’t actually set the names of Ingredients for a given recipe. The pop-up just keeps flipping back to “No Value”. I didn’t think much of it, at first, but this morning I followed the same basic approach used in the book for my own project, and now have the exact same result; my pop-up shows the correct “ingredients” when clicked (thought they’re not ingredients, per se), but it just flips back to “No Value” when I try to select an ingredient. Has anyone else had this problem, and if so, what did you do to fix it? Looking over the general design everything seems to make sense, so I’m pretty confused as to why it doesn’t work.

btw - I’m on 10.6.4, in case that’s a part of the problem…

thanks,

James.

Avatarsmall_pragsmall
06 Aug 2010, 19:03
Marcus S. Zarra (284 posts)

There are a couple of ways depending on how you set up your UI. But it sounds like you need to populate these values in Interface Builder.

Generic-user-small
06 Aug 2010, 22:14
James Maxwell (5 posts)

Well, just as in GrokkingRecipes_v3, the values are populated by the user at runtime (i.e., in GR_v3 this is done using the Ingredients panel window). The thing is, I’m copying the same general model as GR_v3, and I’m seeing the same problem; the names of ingredients in the main window (bottom) can’t be assigned. Clicking on the pop-up shows the options correctly, but upon selecting, the pop-up just flips back to “No Value.” So, my point is that fixing GR_v3 should vicariously offer a fix for my app. The question is, what’s wrong with GR_v3? I build the project, run it, add some authors, ingredients, and units, but when I try to assign ingredients to a new recipe, in the bottom of the main window, the ingredient names don’t stick. If I can fix that, then I’d imagine I can follow the same fix to fix my own app. Make sense? Now, I will note that I didn’t do anything to the downloaded GR_v3 project, so maybe there’s some stuff I’m supposed to do from the book? If so, let me know, and I’ll walk through the book making sure any additional code is added.

– actually, I should clarify: in GR_v3 it doesn’t say “No Value”, it’s just blank.

thanks,

J.

Generic-user-small
07 Aug 2010, 00:18
James Maxwell (5 posts)

Okay, having looked over the tutorial in more detail, I realize it’s mostly about migration. I did realize this, but I assumed the interface would not only migrate, but would also work normally for new recipes. If I make a recipe in v2, then run v3, the ingredients (and units) will be entered properly in the pop-ups in v3. However, if I then try to make new recipes, with new ingredients, they won’t stick in the pop-up. This must be a bug, but what’s the fix? I’d really appreciate the help, since it’s really awkward to explain all this on the Cocoa-Dev list. Since you’ve got the code to v3 on hand, it should be easy enough to figure out what’s wrong. And, as I said before, figuring out what’s wrong here will probably be applicable to my own app, since it’s the same basic design.

thanks,

J.

Avatarsmall_pragsmall
07 Aug 2010, 17:01
Marcus S. Zarra (284 posts)

In Interface Builder (MainMenu.xib), select the combo box and you can see the items that are available.

Image

Further, since the @type@ attribute in the @Recipe@ entity has a default value that matches an item in that list, it will not show up with a “no value” but with the proper item displayed. In the example, it defaults to “Entreé”.

The book is focused on Core Data and therefore does not discuss the particulars of Interface Builder or UI design. That is knowledge that you are expected to either have or to learn from other sources because of the tight/narrow focus of this book.

Generic-user-small
09 Aug 2010, 18:56
James Maxwell (5 posts)

You’re talking about “types”, but I’m talking about “Ingredients” - as added by the user in the Ingredients panel. These don’t “stick”. I understand how types are created in IB, and I’ve used this technique at a different place in my UI, but the system for allowing the user to build a set of items (Ingredients, in this case), and assign those items as relationships to another entity (adding Ingredients to a new recipe - in the main window) isn’t working, or at least not on my system. If you run the current v3 you’ll see what I mean. If you click “Edit Ingredients”, and add a couple of new ingredients in that panel window, then go back to the Ingredients section at the bottom of the main window and create a new ingredient (i.e., using the “+” button at the bottom of the main window), you’ll see that when you click the pop-up for Ingredients->Name, you can view the newly added items, but if you select one, it doesn’t hold - it reverts back to a blank. I understand how it’s set up, in both the data model and IB, and it seems totally logical (which is why I used the same basic approach), but it doesn’t seem to work and I’m wondering why.

  • EDIT: Just a note that maybe part of the confusion is my use of “pop-up”, where I’m actually talking about “combo box”… sorry about that. Double EDIT: Nope… right the first time. It’s a popup!

J.

Generic-user-small
11 Aug 2010, 00:47
James Maxwell (5 posts)

okay, I finally figured it out. The main window’s table view columns should be bound to Selected Object (not Selected Value) of [Recipe_Ingredient arrangedObjects].ingredient (not ingredient.name) – same idea for UnitsOfMeasure. It works as expected now.

J.

You must be logged in to comment