NSPredicateEditorRowTemplate
NSPredicateEditorRowTemplate
- Subject: NSPredicateEditorRowTemplate
- From: Chris <email@hidden>
- Date: Tue, 24 Jun 2008 17:02:56 +1000
I've got a NSPredicateEditor and I'm inheriting from
NSPredicateEditorRowTemplate to make a custom template. It implements
copyWithZone as the doco seems to imply I should. In Interface builder I
have a number of standard row templates, and I've added my custom one at the
end by setting the class in the identity pane.
When I load the nib containing the NSPredicateEditor, for some reason it
calls copyWithZone on my custom NSPredicateEditorRowTemplate during the nib
loading process. Let's call this object passed to copyWithZone as object
"A", and I return from copyWithZone as instance "B". So now there are two
instances created during the nib loading process. Nothing in the
documentation seems to explain why this would happen during nib
loading. From my reading of the doco, it should only get called when I do a
setObjectValue on the NSPredicateEditor.
Anyway, when I call setObjectValue, it does indeed call copyWithZone again
with object "A" and creates another object. Let's call this one "C". It then
calls setPredicate on object "C" as you'd expect, whereupon I populate the
fields of MyCustomPredicateRowTemplate.
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?
_______________________________________________
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