Hello Vitaly,

The Cocoa frameworks do not yet have any classes for specifying a relative date, so you will have to handle this yourself with a subclass of NSPredicateEditorRowTemplate. You can leverage the superclass to do much of the work for you: your responsibility is limited to turning a RelativeDate into units (days, weeks....) and a value in those units, and going the other direction as well.

I wrote a sample showing one way to handle relative dates. For now it is at http://homepage.mac.com/gershwin/RelativeDatesPredicateEditor.zip

As to "no default template for time values," this is a limitation of IB's support for NSPredicateEditor. You can set up a time-editing NSDatePicker programmatically like so:

* Create an NSPredicateEditorRowTemplate that edits dates in IB
* Make an outlet to it
* When your code starts, set the date picker elements to what you want: [[[template templateViews] objectAtIndex:2] setDatePickerElements:elements];

This is a mechanism that NSPredicateEditor supports.

Hope this helps,
-Peter

On Jan 18, 2009, at 8:22 AM, Vitaly Ovchinnikov wrote:

Hello list,

When I add a row template that edits date to predicate editor, it
allows to perform simple comparisons. Like less or greater or equal
etc. Smart folders in Finder allow to add clauses like "Date is within
last X weeks". I can't find a simple way to do the same. It seems that
the only way is to use custom view with that implements what I want,
but want to make sure that it is correct before I start.

Maybe I missed something? Or maybe some standard implementation
already exists? I googled the Internet and this list - nothing.
Any ideas?

Thank you.
_______________________________________________

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/pammon%40apple.com

This email sent to pam...@apple.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 arch...@mail-archive.com

Reply via email to