• 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
NSArraycontroller, Bindings nad NSTableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArraycontroller, Bindings nad NSTableview


  • Subject: NSArraycontroller, Bindings nad NSTableview
  • From: Louis Demers <email@hidden>
  • Date: Thu, 17 Jul 2008 11:52:51 -0400

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 (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: NSArraycontroller, Bindings nad NSTableview
      • From: Louis Demers <email@hidden>
    • Re: NSArraycontroller, Bindings nad NSTableview
      • From: mmalc crawford <email@hidden>
    • Re: NSArraycontroller, Bindings nad NSTableview
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: Re: Inverse Regex Library?
  • Next by Date: NSViewController Binding Problem continued
  • Previous by thread: Re: Where's the best place for addObserver and removeObserver
  • Next by thread: Re: NSArraycontroller, Bindings nad NSTableview
  • Index(es):
    • Date
    • Thread