Hello,

I'm trying to create a custom NSPredicateEditorRowTemplate subclass that has a single view, an NSPopUpButton with a single item and am having some trouble. Basically what I'm trying to do is create a predicate like the one in Apple Mail when creating a rule for handling e-mail in which you can select "Any Message".

In my subclass I have:

- (id)initWithView:(NSView *)view
{
if (self = [super initWithLeftExpressions:[NSArray arrayWithObject:[NSExpression expressionForConstantValue:@"kAnyCalendar"]]
                 rightExpressionAttributeType:NSBooleanAttributeType
                                     modifier:NSDirectPredicateModifier
operators:[NSArray arrayWithObject:[NSNumber numberWithInteger:NSEqualToPredicateOperatorType]]
                                      options:0]) {

        self.parentView = view;
    }
}

- (NSArray *)templateViews {
return [self.parentView subviews]; // This returns my single NSPopUpButton instance
}


In my controller I have an outlet variable named predicateView set to a NSView in my NIB that has a single NSPopUpButton instance, and I'm configuring the NSPredicateEditor as follows:

[predicateEditor setRowTemplates:[NSArray arrayWithObject: [[AnyCalendarTemplate alloc] initWithView:predicateView]]];

When I call [predicateEditor addRow:self] an exception is thrown and my application crashes:

2008-05-19 14:48:51.614 PredicateDebugger[15062:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'In <NSPredicateEditor: 0x1023aa0>, different number of items (1) than predicate template views (0) for template <AnyCalendarTemplate 0x105a7c0: ["kAnyCalendar"] [4] NSBooleanAttributeType>'

I've tried different settings for the NSPredicateEditor in IB, and also tried returning more than one view or type of view in my custom row template, all without luck.

Does anyone have any sample code or suggestions to help me get this working?

Thanks,
Steve

--
Steven Huey Software - http://www.stevenhuey.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