• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
reloading an NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reloading an NSTreeController


  • Subject: reloading an NSTreeController
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 1 Aug 2008 20:04:43 +0700

I have myContentArray, bound to the contentArray of an NSTreeController. And an OutlineView which has its columns bound to the same NSTreeController.

I do [ myContentArray addObject: someObject ] and this is shown in the OutlineView.
Everything works very nicely.


- (IBAction)revertDocumentToSaved:(id)sender
{
	NSMutableArray *newContent = [ [ NSMutableArray alloc ] init ];
	[ outlineTreeController setContent: newContent ];
	[ myContentArray release ]; myContentArray = newContent;

// now rebuild myContentArray
NSError *outError;
[ self readFromURL: [ self fileURL ] ofType: @"DocumentType" error: &outError ];
}


Is this the correct? (At least it seems to work).

But all disclosure triangels are now closed. Is there some way to reopen them to the previous state?
I have the strong feeling that I will have to handle this myself. Ok. So be it.


int numberOfRows = [ outlineView numberOfRows ];
for( int row = 0; row < numberOfRows; row++ )
{
id item = [ outlineView itemAtRow: row ]; // _NSArrayControllerTreeNode
BOOL isExpanded = [ outlineView isItemExpanded: item ];
if (isExpanded)
{
NSString *key = [ item valueForKey: @"Key" ]; <--- does not work.
};
};


The objects in myContentArray are key value coding-compliant for the key Key.

But I get the error message: [<_NSArrayControllerTreeNode 0x3f1fd0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key Key.

So what can I do to identify the expanded item?

Or should I just forget about the NSTreeController and fill the table from a data source?

All this on 10.4.11 Tiger.


Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: reloading an NSTreeController
      • From: Jonathan Dann <email@hidden>
  • Prev by Date: Use the CATransition to switch one layer from another layer with Core Image effects?
  • Next by Date: My own listbox
  • Previous by thread: Use the CATransition to switch one layer from another layer with Core Image effects?
  • Next by thread: Re: reloading an NSTreeController
  • Index(es):
    • Date
    • Thread