Skip navigation.
 
mlRe: NSPredicateEditorRowTemplate
FROM : Chris
DATE : Tue Jun 24 17:35:35 2008

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_removed>> 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

Related mailsAuthorDate
mlNSPredicateEditorRowTemplate Chris Jun 24, 09:02
mlRe: NSPredicateEditorRowTemplate Jim Turner Jun 24, 15:02
mlRe: NSPredicateEditorRowTemplate Chris Jun 24, 15:46
mlRe: NSPredicateEditorRowTemplate Jim Turner Jun 24, 16:52
mlRe: NSPredicateEditorRowTemplate Chris Jun 24, 17:35