Hi,

No, I'm doing that all correctly. But now I seem to have changed something minor, but I'm not sure what, and now its working. Now its copying the object across correctly when I call objectValue.

Anyway, thanks for the setObjectValue tip which was the key. I never would have guessed that one.


On 25/06/2008, at 12:52 AM, Jim Turner wrote:

On Tue, Jun 24, 2008 at 8:46 AM, Chris <[EMAIL PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to