1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Core Data, bindings, NSButtonCell junk

Discussion in 'Mac Programming' started by Super Macho Man, Aug 13, 2006.

  1. macrumors 6502a

    Super Macho Man

    #1
    I'm working on a Core Data app, following the examples I'm seeing on the web. This is my last major stumbling block to a successful working application...

    I have an NSArrayController called Fish that contains a bunch of different fish. And I have another NSArrayController called Aquarium that contains a bunch of different aquariums.

    I want to be able to specify in which aquarium a particular fish lives. I want to do this by having a list of all my aquariums in the right column of an NSTableView, and NSButtonCells (checkboxes) in the left column. So when I click on a particular fish in NSTableView #1, I can see which aquarium is checked in NSTableView #2. See my post further down for a visual example.

    My xcdatamodel currently looks like: Fish <---->> Aquariums.

    P.S. Is there a way to do this exclusively in Interface Builder? :eek:

    Or is there a better way to do this altogether?

    Edit: I will send $40 via Paypal to the first person who can walk me through this and help me get it working. The image below is what I'm talking about. I want to make which items are checked in Table 2 depend on the selection in Table 1, but the contents of Table 2 (aside from the checkboxes) should be the same as Table 3. I have been going by the tutorial on this page: http://www.cocoadevcentral.com/articles/000085.php

    PM me!

    Edit: Bounty increased to $40.
     
  2. macrumors regular

    #2
    Dang it! If I had a mac with me right now I'd definately be able to help you. I'm stuck in Boston right now at my girl friends place and won't be back on my mac with all my code until next monday. If no one can help you by then (which I doubt, the guys on here are great) I'll see what I can come up with.
     
  3. macrumors 68030

    slooksterPSV

    #3
    As long as you set all of them up, then yes. So for example:
    I add a Media (not sure if you mean DVD, CD, VHS, etc.) so I click VHS, and I add all the titles and the ones that are selected (checked) store an isTypeOfMedia or that bool value, now do you want it to show both selected and non or just selected
     
  4. macrumors 68030

    slooksterPSV

    #4
    Does this help?
    When I select my class, it shows assignments in those classes and loads that data. In the assignments controller the content set is the Classes Controller's classAssignments which is a relationship to Assignments which has an inverse relationship to theClass which is a relationship in Assignments.

    Anyways, I gave you 3 screenshots to try and help you out, anything that is set will be shown depending on what you select. If you need the source to my ADM program, just let me know.

    EDIT: OK HERE'S AN UPDATE:
    When I made a 4th column and linked that column to my isCompleted BOOL flag, it saved, it knew if it were checked to save it and make sure that the flag for it was saved, so yes, how I stated above, will work.

    EDIT 2: You can also add a search bar and make a predicate to be if the value is set so they can search for what is just set in the one column.
     

    Attached Files:

  5. macrumors 6502a

    Super Macho Man

    #5
    I think I get what you're saying, but I'm not sure if it quite matches what I want to do. I want my Table 2 to be a complete list of all media - in other words its contents should match what are in Table 3. When I change the selection in Table 1, the Call # column in Table 2 should stay the same - the only thing that should change is which boxes are checked.

    In other words, by clicking on something in Table 1, I'm not narrowing down the list in Table 2. Table 2 is like a restaurant menu and the entries in Table 1 are like customers - each customer is ordering something different, but the menu is the same for everybody. (If that makes any sense :) )

    I can bind a table column to Media Call # and another to mediaIsChecked and the checkboxes will work, but not depending on which footage is selected. Likewise I could make a footageIsChecked BOOL but then I don't know how to associate that with anything in my Media entity.
     
  6. macrumors 68030

    slooksterPSV

    #6
    And there's the part I missed. You don't want to have to enter all the data into each of the media's. So let me try something then I'll post with my results.
     
  7. macrumors 6502a

    Super Macho Man

    #7
    This is just an update of what I'm trying to accomplish, it's basically the same as above but with a 4th table (the "inverse" of Table 2) and it deals with fish and aquariums just to make the relationship clearer (fish <<--> aquariums).

    Edit: Whoops I screwed up one of the screenshots, here are the new ones.
     

    Attached Files:

  8. macrumors 68030

    slooksterPSV

    #8
    Sorry I don't know how to do it like that. Objective-C would be easier, CoreData, I'm not sure how you'd do that.

    With objective C you could store arrays and arrays of stuff.
    E.g. Aquariums->List of Fish->Selected Aquarium->Fish Check fish in aquarium
    So you'd have to have a list of aquariums, if the aquarium is selcted, then an array in that aquarium would be of the fish, and those fish would be an object of name and ischecked. So
    Aquariums->Fish->Name, isChecked
    Array->Array->Object

    Fish->Aquarium->Name, isChecked
    Array->Array->Object
     
  9. macrumors 6502a

    Super Macho Man

    #9
    :) Thanks for trying to help at least :) This is turning out to be a harder problem than I thought it would be. But I'd really like to get it done with bindings/Core Data.

    Great! Looking forward to it :)
     
  10. macrumors 6502a

    Super Macho Man

    #10
    Bounty still available and has been raised to $40. :)
     

Share This Page