Problem with NSTreeController bindings.
Problem with NSTreeController bindings.
- Subject: Problem with NSTreeController bindings.
- From: Paul Heal <email@hidden>
- Date: Mon, 15 Aug 2005 14:20:45 -0600
So I've created a little test project to play with NSTreeController.
Here's the interface of the class I'm using (just some dumb object with
autogenerated declarations and definitions) ...
@interface DumbObject : NSObject {
NSString *name;
NSCalendarDate *dateCreated;
NSString *note;
NSMutableArray *offspring;
}
- (NSString *)name;
- (void)setName:(NSString *)value;
- (NSCalendarDate *)dateCreated;
- (void)setDateCreated:(NSCalendarDate *)value;
- (NSString *)note;
- (void)setNote:(NSString *)value;
- (NSArray *)offspring;
- (unsigned)countOfOffspring;
- (id)objectInOffspringAtIndex:(unsigned)theIndex;
- (void)getOffspring:(id *)objsPtr range:(NSRange)range;
- (void)insertObject:(id)obj inOffspringAtIndex:(unsigned)theIndex;
- (void)removeObjectFromOffspringAtIndex:(unsigned)theIndex;
- (void)replaceObjectInOffspringAtIndex:(unsigned)theIndex
withObject:(id)obj;
In Interface Builder I dropped an OutlineView on my window, then a
NSTreeController.
On the tree controller I set Mode to class, then ObjectClassName to
DumbObject. Added keys "name", "dateCreated" and set Children Key Path to
"offspring".
Now in outlineView I set the following bindings.
OutlineView
content = NSTreeController arrangedObjects
Column 1
value = arrangedObjects.name
Column 2
value = arrangedObjects.dateCreated
Finally I added three buttons with add, addChild and remove actions of the
NSTreeController object.
Now when I build and run anytime I click the add or add child buttons it
only adds or adds a child to the last added object. It doesn't matter if I
change the selection in the outline view or not. It seems to only consider
the last added object as the selected object to add or add a child to.
Is there another binding or a connection that I'm missing for the
NSTreeController to work?
Any help is appreciated.
_______________________________________________
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