Skip navigation.
 
mlHelp with NSArrayController, NSTableView and NSOpenPanel
FROM : Kam Dahlin
DATE : Thu Jun 22 22:43:24 2006

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."

Related mailsAuthorDate
mlHelp with NSArrayController, NSTableView and NSOpenPanel Kam Dahlin Jun 22, 22:43
mlRe: Help with NSArrayController, NSTableView and NSOpenPanel George Orthwein Jun 23, 04:31
mlRE: Help with NSArrayController, NSTableView and NSOpenPanel Kamrin Dahlin Jun 23, 04:50
mlRe: Help with NSArrayController, NSTableView and NSOpenPanel George Orthwein Jun 23, 15:45
mlRE: Help with NSArrayController, NSTableView and NSOpenPanel Kamrin Dahlin Jun 23, 17:33
mlRe: Help with NSArrayController, NSTableView and NSOpenPanel George Orthwein Jun 23, 20:47
mlRE: Help with NSArrayController, NSTableView and NSOpenPanel Kamrin Dahlin Jun 23, 20:51
mlRE: Help with NSArrayController, NSTableView and NSOpenPanel Kamrin Dahlin Jun 23, 23:58
mlRe: Help with NSArrayController, NSTableView and NSOpenPanel Kam Dahlin Jun 24, 01:15
mlRe: Help with NSArrayController, NSTableView and NSOpenPanel Scott Anguish Jun 24, 08:20