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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to