• 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
Bindings and multiple ArrayControllers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bindings and multiple ArrayControllers


  • Subject: Bindings and multiple ArrayControllers
  • From: Marcus Karlsson <email@hidden>
  • Date: Sat, 24 Feb 2007 13:55:45 +0100

Hi.

I have created a Cocoa application. MainMenu.nib has two tableviews. Each tableview has two buttons. Add and Remove.
I have two ArrayControllers. GroupController and PersonController.


Using bindings I have set the first column in the first tableview to bind value to GroupController using arrangedObjects with key path name. The first column in the second tableview binds value to PersonController using arrangedObjects with key path name.

Both GroupController and PersonController is set to use the object class Entry and both has name listen as keys.


This is Entry.h:

#import <Cocoa/Cocoa.h>

@interface Entry : NSObject {
	NSString *name;
}

- (NSString *)name;
- (void)setName:(NSString *)aName;

@end


This is Entry.m:

#import "Entry.h"

@implementation Entry

- (id)init
{
	[super init];
	[self setName:@"New Entry"];
	return self;
}

- (NSString *)name
{
	return name;
}

- (void)setName:(NSString *)aName
{
	aName = [aName copy];
	[name release];
	name = aName;
}

- (void)dealloc
{
	[name release];
	[super dealloc];
}

@end


When I push the Add buttons, new entries are created and displayed in the appropriate tableview.


How do I make the second tableview depend on the selected entry in the first tableview?

I have searched the documentation and I tried to set the PersonController to bind contentArray to GroupController using selection with name as key path. However when I try to add new entries to the first tableview it creates the entry and generates an error message:

NSRunLoop ignoring exception 'Cannot create NSArray from object New Entry of class NSCFString' that raised during posting of delayed perform with target 35f5c0 and selector 'invokeWithTarget:'


What should I do?


Thank you.

Marcus
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Bindings and multiple ArrayControllers
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Newbie question: getting an object back from just a pointer
  • Next by Date: Re: Custom NSView That is iChat Chat Log Like
  • Previous by thread: Re: Newbie question: getting an object back from just a pointer
  • Next by thread: Re: Bindings and multiple ArrayControllers
  • Index(es):
    • Date
    • Thread