RE: NSArrayController, TableView and not showing data
RE: NSArrayController, TableView and not showing data
- Subject: RE: NSArrayController, TableView and not showing data
- From: "Kamrin Dahlin" <email@hidden>
- Date: Wed, 5 Jul 2006 18:39:31 -0700
- Thread-topic: NSArrayController, TableView and not showing data
Dont' know if this will help, but I had a problem using NSMutableArray with an NSArrayController and I found that if I added/removed content to the NSMutableArray using "mutableArrayValueForKey:" did the trick.
Apple's Cocoa Bindings docs go over this.
good luck,
k
-----Original Message-----
From: cocoa-dev-bounces+kamd=email@hidden on behalf of Matt Neuburg
Sent: Wed 7/5/2006 6:10 PM
To: Trygve Inda
Cc: email@hidden
Subject: Re: NSArrayController, TableView and not showing data
On or about 7/5/06 5:48 PM, thus spake "Trygve Inda"
<email@hidden>:
>> On Wed, 05 Jul 2006 22:39:46 +0000, Trygve Inda <email@hidden>
>> said:
>>> In my AppController I have:
>>>
>>> NSMutableArray* pluginInstances;
>>>
>>> This is alloc'ed and loaded with data on launch and contains 1 item.
>>>
>>> I have an NSArrayController in my nib set up as:
>>>
>>> ObjectClassName: NSObject (several kinds of classes might be in the array)
>>>
>>> Binding (contentArray) points to pluginInstances in my AppController
>>>
>>> I also have a TableView in a sheet window. The identifier for the column is
>>> pluginName (which is an instance variable in my pluginObject
>>>
>>> I have bound the TableView column to arrangedObjects with a model key path
>>> pluginName.
>>>
>>> So... When I first bring up the tableView, there is nothing in it (although
>>> the array has one item). If I click on the column header, the item appears.
>>>
>>> How can I get it to automatically appear the first time?
>>
>> You're not giving enough information for anyone to do more than guess, but
>> my guess is that the problem is "alloc'ed and loaded with data". You must do
>> this in an observable way (e.g. setValue:forKey:) or the NSArrayController
>> won't realize that anything has happened. m.
>
> I did get it to work by setting the content of the ArrayController
> explicitly, but how could I use setValue:forKey: in this case?
I *said* I don't have enough information. But you did seem to be saying that
that your NSArrayController is bound for its content to an instance variable
called "pluginName". If so, how you set that instance variable is crucial.
m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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
_______________________________________________
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