Re: NSPredicateEditorRowTemplate
Re: NSPredicateEditorRowTemplate
- Subject: Re: NSPredicateEditorRowTemplate
- From: "Jim Turner" <email@hidden>
- Date: Tue, 24 Jun 2008 08:02:12 -0500
On Tue, Jun 24, 2008 at 2:02 AM, Chris <email@hidden> wrote:
> When the user clicks ok, then I call objectValue on the NSPredicateEditor
> and it calls predicateWithSubpredicates not on object "C", but on object
> "B", which is always going to be blank, because it is in fact object "C"
> which is the one displayed. Thus I can never retrieve values from the row.
> This phantom and unexplained object "B" that is created during NIB loading
> suddenly seems to be the one it cares about.
>
> I'm not sure where to go next. Has anyone got any advice?
Hi Chris,
I saw this very same behavior and was fortunate enough to get the
following explanation from Peter Ammon:
"A single row may be composed of views from multiple templates. When
it's time to construct a predicate for that row, we pick one template,
and if its views are not actually in the row, we call objectValue on
the view in the row, and then setObjectValue: on the corresponding
view in your template.
Due to a bug, this happens more often than it should :(
What this means for your NSTextField subclass is that it should do the
right thing for objectValue and setObjectValue:. The object value of
your view should encapsulate all the state your template needs to
compute that portion of the predicate."
The short answer, for me at least, was to make sure my custom
NSTextField in my template handled objectValue/setObjectValue:
properly. That way, when predicateWithSubpredicates: is called, the
internals of the editor can pass around the values needed to properly
compute the predicate.
--
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