Hi,
I've programmed for a while in Cocoa, with bindings... But for the first time I need a NSTableView and I would like to use NSArrayController with bindings to do as much work as possible and with the minimum amount of code. But I've had nothing but failure, even after inspecting many examples and tutorials on google.

Initially I believed that NSArrayController would store the array itself but I now resorted to having my own NSMutableArray (with getter and setters) in my model.

A button bound to the "add" or the "insert" method of the NSArrayController just does nothing. To debug things, I created a subclass of NSArrayController to intercept the "add" method and confirm that it does get called but it does not create and insert any object. The NSControllerArray instance is configured to generate object of class toto (with editable chedked and preapres content uncheked).

and it's binding is pointing to where my NSMutableArray is located

Controller Content
        bind to myController instance
        controller Key is empty
        Model Key Path is set to the accessor of my array

In my subclass of the NSArrayController array, if I create a toto object and use addObject, it works ! Even the NSTableView gets updated !

-       (void)add:(id)sender;
{
        [super add:sender];             // Does not work
        NSLog(@"count %d" , [[super content] count]);
        
        [super addObject:[[toto alloc] init]];  // Works
        NSLog(@"count %d" , [[super content] count]); 
}


Any clues why the "add" method does not work ?

If anybody as such a trivial sample/tutorial, I'd be very grateful, (after a third nights of banging my head against this problem)


Thanks.


PS:
Xcode 3.1
Component versions
Xcode IDE: 1099.0
Xcode Core: 1100.0
ToolSupport: 1086.0
IB Version 3.1 (670)


Louis Demers eng.
www.obzerv.com


_______________________________________________

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