Help with NSArrayController, NSTableView and NSOpenPanel
Help with NSArrayController, NSTableView and NSOpenPanel
- Subject: Help with NSArrayController, NSTableView and NSOpenPanel
- From: Kam Dahlin <email@hidden>
- Date: Thu, 22 Jun 2006 13:43:24 -0700
Hello,
I am just getting started with Cocoa (know what your thinking,
another newbie just great). Well, I come from a good Java background
so I am not a complete loss. : )
What I am having trouble with is a Cocoa Document based project that
uses bindings. Bindings are a whole new world for me and I am having
trouble getting my different objects to talk correctly.
Specifically, I have created a simple model class that has two members:
NSString *dirName // name of a directory
NSMutableArray *dirContents // contents of the directory.
I have accessors for these member vars and have tried to make
everything as KVC and KVO compliant as i know how.
In my MyDocument controller I have another member:
NSMutableArray *directoryModels // contains a list of all of the my
directory model objects.
I have a simple interface with a single button that triggers
NSOpenPanel which I use to select a target location.
I also have a NSTableView which I would like to display the dirName
variable value for every directory model object in my directoryModels
array. I have followed the tutorials on CocoaDevCentral and on
MacDevCenter for setting up NSArrayController and NSTableViews, but
it doesn't seem to be working for me.
I have setup the NSArrayController to look at my directoryModels
class and it has one key dirName
I then set my NSTableViewColumn to be bound to the
NSArrayController.arrangedObjects dirName key.
I have setup a NSObjectController which is bound to the File's Owner
object and I have setup the NSArrayController to have its
contentArray set to the directoryModels object.
When I run my project, I can open and select a new location, all of
my directoryModel objects are created correctly, but nothing ever
shows up in my NSTableView.
As a test, I simplified my project and created an array of just the
directory names in the MyDocument controller and then had the
NSArrayController look at it. When i ran my project, it put all of
the names in the tableview but inside of a single row of the table.
At least something happened.
At this point, I am stuck. I am not sure where to look and thus this
email.
If anyone could give me a push in the right direction, I would really
appreciate it.
Regards,
k
"Standing before you, to stand behind you, to tell you something I
know nothing about."
_______________________________________________
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