NSPredicateEditorTemplateRow , pop up with Core Data objects
NSPredicateEditorTemplateRow , pop up with Core Data objects
- Subject: NSPredicateEditorTemplateRow , pop up with Core Data objects
- From: Dan Waltin <email@hidden>
- Date: Fri, 10 Apr 2009 23:37:06 +0200
Hi,
I'm trying to create a NSPredicateEditorTemplateRow where the last
view is a popup, containing every item of a particular CoreData entity
(named StudyVisit).
In a previous mail to this list (Oct 16, 2008) I saw a tip that one
could have an IBOutlet link to an NSArrayController, which should
contain all the items needed.
I've tried to implement this, but can't seem to get it right. I've
googled for a few hours using various combinations of
NSPredicateEditor, NSPredicateEditorRowTemplate, "Core Data" etc but
found nothing.
My futile attempts so far are as follows: I've created an
NSPredicateEditorTemplateRow subclass with an IBOutlet as follows:
IBOutlet NSArrayController * studyVisitsController;
In IB I've linked this outlet to an array controller, which is set up
correctly (when used to bind to an NSTableView, everything works as
expected).
Then I override the templateViews method, as follows:
- (NSArray *)templateViews
{
NSArray *parentViews = [super templateViews];
NSMenu *menu = [[parentViews objectAtIndex:2] menu];
if (studyVisitsController != nil)
{
for (id studyVisit in [studyVisitsController arrangedObjects])
{
[menu addItemWithTitle:[studyVisit valueForKey:@"title"] action:nil
keyEquivalent:@""];
}
}
return parentViews;
}
But here the studyVisitsController always contains 0 (zero) objects,
although there ought to be a handful objects. Which means that I'm
never adding any items to the menu.
What am I doing wrong? Are there any more methods I should override?
Why is the studyVisitsController always empty?
Kind regards
/Dan
_______________________________________________
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