Newbie cocoa/ObjC question in a Bindings based app

tji

Registered
I've done a few simple apps, similar to the examples in the Hillegas book, and I'm trying to do the next level of complexity, and running into some roadblocks. I think I'm just looking at through the eyes of a C/Procedural programmer, and probably missing the simple solution.

I have a main window, with an NSTableView with a list of financial transactions, it contains info like {Deposit Date, Bank Used, Deposit Amount, Interest Rate, Annual Fees} which it uses to calculate the Total Value. So, I've got my 'Loan' class/model; with an NSArrayController, and NSTableView. And, that all works after setting up the bindings in Interface Builder.

Next, I add a bit more complexity. I add a secondary Panel, where I can manage information about the Banks {Bank Name, Interest Rate, Annual Fees}, so the user doesn't need to enter it for every single transaction. The panel itself works fine, with Bindings: Bank Class/Model, NSArrayController, NSTableView. And, I tied the two tables together via bindings and an NSPopUpButton in the "Banks" column of the main table (the user can select the Bank Name from a pulldown list).

It works fine at this point, but going the next step has failed for me. When the user selects the Bank name in the main window, I want to also fill in the interest rate and fees, which are stored in the "Banks" table/array. I couldn't find any way to do this with the bindings configurations in IB, and I'm trying to find the right way to proceed. (The bindings options didn't seem applicable, as I don't just want the 'selection; form the Banks table, I want the values associated with the bank chosen via the PopUp, regardless of how the selection changes.)

From my C mindset, I see the problem as a scope issue: how do I access the Banks data, from within the Loans objects?
- Is there any way to access the "Banks" data from within my "Loans" class/model. e.g. in the setLoanInterest accessor, look up the values based on the bank name?
- Is my "Model" wrong, using separate classes/controllers for each table/array?
- Or, do I need to add a custom controller, where both the Loans and Banks NSMutableArrays are available, and I can override some of the bindings, and move the bank data over as needed?

Any help is appreciated. Thanks.
 
Back
Top