• 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: NSTreeController Filtering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTreeController Filtering


  • Subject: Re: NSTreeController Filtering
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 21 Jul 2005 18:16:07 -0400

the arrangedObjects for NSTreeController are totally opaque. You should not assume, ,or expect, them to be of any specific class.


On Jul 21, 2005, at 2:24 PM, Noah Lieberman wrote:

Hello,

I'm trying to make a subclass of NSTreeController that will allow me to do filtering using a search field. I can't believe that filterPredicate wasn't implemented in NSTreeController... Anyway, I've looked at some posts on cocoabuilder, and done some reading and I found people talking about using the private method "observedObject" to try and get around the proxy object issue. But I'm having trouble.

I implemented filterPredicate and setFilterPredicate methods, and overrode arrangedObjects:

- (id)arrangedObjects
{
//TODO, keep in mind that observedObject is a private method... there should be a better way to do
//this but, arrangedObjects is returning a proxy instead of an actuall array
id arrangedObjectsProxy = [super arrangedObjects];
id arrangedObjectsArray = [arrangedObjectsProxy observedObject]; //This doesn't work


if([self filterPredicate] != nil)
{
return [arrangedObjectsArray filteredArrayUsingPredicate: [self filterPredicate]];
}
else
{
return arrangedObjectsArray;
}
}


This fails though because apparently the arrangedObjects method returns an _NSControllerTreeProxy, which does not respond to the observedObject method. However, in order to get a filtered array, I have to have an array... This initially seemed like it should be simple, but perhaps is not...

Any suggestions? What's the recommended method for creating a filtering tree controller, the header file specifically indicates that they expect people to do this, and to use rearrangeObjects to trigger it... however it would sure be nice to be able to use the search bindings of a search field to set the filterPredicate...

Thanks,

Noah
_______________________________________________
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


_______________________________________________ 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: NSTreeController Filtering
      • From: Todd Blanchard <email@hidden>
References: 
 >NSTreeController Filtering (From: Noah Lieberman <email@hidden>)

  • Prev by Date: Re: [Moderator] MUST READ: Posting private messages
  • Next by Date: Re: Reading system preferences?
  • Previous by thread: NSTreeController Filtering
  • Next by thread: Re: NSTreeController Filtering
  • Index(es):
    • Date
    • Thread