On 1 Aug 2008, at 14:04, Gerriet M. Denkmann wrote:
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.
It's a common problem. Can I point you here: http://www.cocoabuilder.com/archive/message/cocoa/2008/2/23/199705
int numberOfRows = [ outlineView numberOfRows ]; for( int row = 0; row < numberOfRows; row++ ) {id item = [ outlineView itemAtRow: row ]; // _NSArrayControllerTreeNodeBOOL 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.
This will not work as in the line: NSString *key = [ item valueForKey: @"Key" ]; you're effectively doing this: NSString *key = [item Key];which clearly won't work as whatever class your 'item' is doesn't have a method with the signature: Key. For this to work you'd need -Key (and then likely -setKey:) in your class. I'd have another look at the documentation on KVC.
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/KeyValueCoding.html If, for example I were to have the class: @interface MyClass : NSObject { NSArray *myArray; } - (void)setMyArray:(NSArray *)newValue; - (NSArray *)myArray; @end Then I could safely do this: MyClass *item = [[[MyClass alloc] init] autorelease]; NSArray *anArray = [item valueForKey:@"myArray"]; or NSString *key = @"myArray"; MyClass *item = [[[MyClass alloc] init] autorelease]; NSArray *anArray = [item valueForKey:key];Having said all this, isn't _NSArrayControllerTreeNode private, with all the caveats that apply to using private classes. You're not guaranteed that instances of this class with respond to *anything*.
Hope this helps, Jonathan http://espresso-served-here.com
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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]