Re: NSPredicateEditorRowTemplate
Re: NSPredicateEditorRowTemplate
- Subject: Re: NSPredicateEditorRowTemplate
- From: "Jim Turner" <email@hidden>
- Date: Tue, 24 Jun 2008 09:52:14 -0500
On Tue, Jun 24, 2008 at 8:46 AM, Chris <email@hidden> wrote:
>
> Hi!
> This is very interesting information. Wish it was in the doco!
> I have a custom view which wasn't responding to setObjectValue /
> objectValue.
> When I add those methods I find that on startup it does indeed copy the
> values from object "C" to object "B". This means that when I retrieve the
> values later on, instead of returning blank like before, it now returns the
> old value instead of blank. However I need the new value! If it were to copy
> the values across AFTER the user made changes or prior to me calling
> objectValue, then it would work. I thought maybe [rulePredicateEditor
> reloadPredicate] sounded like it might do it perhaps, but that doesn't help
> either. Once the user hits ok, we are still left with bogus values from
> object "B", albeit now old values instead of nil values.
How are you accessing your custom view's object value? It almost
sounds like you're asking your original custom view for it's value
each time instead of the object currently being displayed.
When you create your template and insert your custom view, make sure
to keep a reference to that specific object so you can query it later
on.
@interface CustomPredicateEditorRowTemplate : NSPredicateEditorRowTemplate
{
CustomTextField *myTextField;
}
-(CustomTextField *) myTextField;
@end
@implementation CustomPredicateEditorRowTemplate
-(CustomTextField *) myTextField
{
if( !myTextField )
// init your view
return( myTextField );
}
- (NSArray *)templateViews
{
return( [[super templateViews] arrayByAddingObject:[self myTextField]] );
}
-(void) dealloc
{
[myTextField release];
[super dealloc];
}
- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
id objectValue = [[self myTextField] objectValue];
// Do magical things with objectValue
}
@end
--
Jim
http://nukethemfromorbit.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