Bindings between nib files?
Bindings between nib files?
- Subject: Bindings between nib files?
- From: Michael Carter <email@hidden>
- Date: Thu, 28 Apr 2005 15:20:37 -0700
- Newsgroups: apple.lists.cocoa-dev
- Organization: Apple
- Xref: news.apple.com apple.lists.cocoa-dev:91208
Hello all.
I'm writing a Cocoa app (non-Document) in which I'll be maintaining a
list of Employee objects which will be associated later to a task
object. In order to add/edit employees I decided to create a separate
nib file. There is an array in my app controller that contains Employee
objects. This separate nib has a table view on the left where I show all
the employee objects in the array. Selecting a name on the left will
display details on the right, which has 8 NSTextFields to hold the data
which pertains to the employee.
So far I've set up bindings between the master-detail views in the nib.
I've also set up an NSArrayController which points to the Employee class
object. my app controller object has an instance variable of type
NSWindowController which I use to reference the employee panel:
@interface AppController : NSObject
{
// model
NSMutableArray *routeList; // array of routes
NSMutableArray *emps; // array of employees
NSMutableArray *categories; // array of categories
// view
NSWindowController *empPanelController; // employee panel
}
- (IBAction) showEmpPanel:(id)sender;
[...]
@end
The nib's File's Owner is set to NSWindowController, and i instantiate
the ivar when showEmpPanel: is sent from a menu item. The panel shows up
fine when I compile and run the app, and I can add and delete employees
via local buttons bound to the NSArrayController's add: and delete:
methods. However, I can't seem to connect the NSArrayController to the
*emps array in order to actually put the employee objects I'm creating
via bindings into that array! Ack!
Connecting the NSArrayController to the File's Owner placeholder in the
nib would mean connecting it to the instance of NSWindowController in my
app controller, right? That ivar doesn't know what the *emps array is,
so that didn't work. The only other default options are Shared User
Defaults and Shared App. I can't think of any other way to connect it.
How best would I handle communicating between the nib and the *emps
array in my app controller? I have a popup in my main window which I'd
like to have all the employees show up in. I'm having trouble binding
that to the *emps array as well.
I added a button on my main window and a text field I use to query [emps
count] to verify how many objects actually are in that array. Nothing
I've done so far shows objects being added to that array. Help!
Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden