Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Bindings / Core Data / Tableview / Buttoncell problem

Bindings / Core Data / Tableview / Buttoncell problem
Thread Tools
GopherAlex
Fresh-Faced Recruit
Join Date: Jun 2006
Status: Offline
Reply With Quote
Aug 16, 2006, 11:57 PM
 
Hello, I am very much a Cocoa newbie/idiot and I'm trying to build a simple Core Data application. I have followed the tutorial at http://www.cocoadevcentral.com/articles/000085.php and it was great - I now have a similar app up and running and I love it. But I want a little more functionality and here's where I'm running into problems, even after many hours of trial & error spent in search of a solution.

So I have two entities, Fish and Aquarium. (Fish <<--> Aquarium in the xcdatamodel) In Interface Builder, I have FOUR tableviews:

Table 1 lists the names of all fish. (Bound to Fish NSArrayController in IB)
Table 3 lists the labels of all aquariums. (Bound to Aquariums NSArrayController in IB).

The hard part is Tables 2 and 4. Table 2 should have NSButtonCells (checkboxes) in the left column and a list of all aquariums in the right column - which checkboxes are checked should depend on the selection of fish in Table 1. Likewise, Table 4 should be setup the same way, but relating to Table 3, and the checkboxes should be radio buttons instead (to properly reflect the one-to-many relationship between aquariums and fish).

I think a picture is worth a thousand words here:



I really need a solution to this, preferably using as little code as possible - none if at all possible. It should be a simple matter of bindings in IB, should it not? In any case, I'm so frustrated that I'll send the first person who successfully walks me though this $20 via Paypal.
     
macrophyllum
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Sep 4, 2006, 09:12 AM
 
Hi,

I am not trying to help for the $, but just saw that no one has responded.

For table 2 I am pretty sure you want to bind the array controller to the "selection" of the table 4 (aquarium) controller. Similarly bind table 4 to the selection of table 3. For the checkboxes and radio buttons I am pretty sure that you will need to use key-value observing and watch for changes, which will involve writing code.

If you didn't want to right code then you should probably re-think the UI. Perhaps you should have a list of all aquariums and all fish. Then have a list of "aquarium" contents which gets populated when you select an aquarium. This last list should have a fish-column with a pop-up button cell whose contents are bound to the "fish array controller".

I hope that makes sense, it is early here and I have only had one cup of coffee.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:47 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,