• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSPredicateEditorRowTemplate: Custom templateView state
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicateEditorRowTemplate: Custom templateView state


  • Subject: Re: NSPredicateEditorRowTemplate: Custom templateView state
  • From: Mario Fischer <email@hidden>
  • Date: Wed, 4 Jun 2008 23:27:42 +0200

Hi Peter,

yes of course, thanks!

Am 04.06.2008 um 22:27 schrieb Peter Ammon:

On Jun 3, 2008, at 12:05 PM, Mario Fischer wrote:

Hi -

- I use the NSPredicateEditor with a custom NSPredicateEditorRowTemplate
- This custom component should implement something like this:
[Filesize] - [is smaller/greater than] - [Textfield] - [KB/MB/GB]


By overriding templateViews I'm able to add an additional NSPopupButton to the existing ones:

- (NSArray *)templateViews
{
NSArray* myviews = [super templateViews];
NSPopUpButton* myButton = [[NSPopUpButton alloc] init];
[myButton addItemsWithTitles:[NSArray arrayWithObjects:@"KB", @"MB", @"GB", nil]];
return [NSArray arrayWithObjects: [myviews objectAtIndex:0], [myviews objectAtIndex:1],[myviews objectAtIndex:2], myButton, nil];
}


But in predicateWithSubpredicates I can't find out, which of the entries the user selected:

- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
[[[self templateViews] objectAtIndex:1] titleOfSelectedItem]; // works
[[[self templateViews] objectAtIndex:3] titleOfSelectedItem]; // is always the first entry, regardless of the user selection..
...
}


What am I missing here / doing wrong?

Hi Mario,

Your code is creating a new instance of NSPopUpButton with every call to templateViews. When you call templateViews again to check the value of the last popup, you get a different popup every time.

It looks like maybe you just accidentally declared myButton as a local variable instead of an instance variable.

-Peter

Mario Fischer | email@hidden


_______________________________________________

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


References: 
 >NSPredicateEditorRowTemplate: Custom templateView state (From: Mario Fischer <email@hidden>)
 >Re: NSPredicateEditorRowTemplate: Custom templateView state (From: Peter Ammon <email@hidden>)

  • Prev by Date: [SOLVED2] Code to convert NSDictionary to binary plist file?
  • Next by Date: Re: invoking quicklook via code
  • Previous by thread: Re: NSPredicateEditorRowTemplate: Custom templateView state
  • Next by thread: Digital Librarian
  • Index(es):
    • Date
    • Thread