• 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
Re: NSArrayController subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController subclass


  • Subject: Re: NSArrayController subclass
  • From: Bertrand Landry Hetu <email@hidden>
  • Date: Tue, 21 Sep 2004 01:10:32 -0700


I tripled checked the nib file, the NSArrayController is using the subclass, and I confirmed this by overriding the selectionIndexes function and putting break points. I have a button that has the "enabled" value bound to the canDoSomething controller key, no keypath. The button never enables when something is selected. There is not much code: the array controller is bound to the file's owner array which is KVC comp., I have a couple of NSTableViews bound to arrangedObjects and selectionIndexes and they are all working and KVO is doing its job. canDoSomething is invoked initially when bind: is invoked on the NSArrayController subclass, but not when the selection changes, so I'm deducing the binding is working but it is lacking some KVO event.


This function will become more complex later on, I kept it as simple as possible to get this working.

-(BOOL)canDoSomething
{
	NSIndexSet * indexes = [self selectionIndexes];

	if ([indexes count] == 0)
		return NO;

	return YES;
}

Bertrand.

On 20 sept. 2004, at 23:13, Scott Stevenson wrote:


On Sep 20, 2004, at 10:35 PM, Bertrand Landry Hetu wrote:

I'm trying to do a subclass of NSArrayController that would add accessors similar to canAdd, canRemove. And I'm running in the following issue: I'm not getting changes as the selection changes.

I added [self setKeys: [NSArray arrayWithObject: @"selectionIndexes" triggerChangeNotificationsForDependentKey: @"canDoSomething"] to my +(void)initialize and I expected it to work but no.

I haven't tried this myself (maybe somebody else has), but can't see offhand why it wouldn't work.


How did you use "canDoSomething"? Did you bind something to it or register for notifications?

Are you sure you selected the subclass in IB?


In other words, what specifically isn't working? Can you post sample code?


   - Scott


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ 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
  • Follow-Ups:
    • Re: NSArrayController subclass
      • From: Bertrand Landry Hetu <email@hidden>
References: 
 >NSArrayController subclass (From: Bertrand Landry Hetu <email@hidden>)
 >Re: NSArrayController subclass (From: Scott Stevenson <email@hidden>)

  • Prev by Date: Re: NSData questions (including Altivec)
  • Next by Date: Re: Select a NSBezierPath
  • Previous by thread: Re: NSArrayController subclass
  • Next by thread: Re: NSArrayController subclass
  • Index(es):
    • Date
    • Thread