Can you bind the timeInterval attribute to NSDatePicker?

I have a Core Data application that has an Event class that has a start date and an end date. It's trivial to link them to two NSDatePicker widgets, but I wanted it to work with the NSRangeDateMode available in Leopard.

NSDatePicker has a couple of methods that handle timeInterval, but I can't seem to bind to that.

Update . I used a manual call to bind and it works half way:

[picker bind:@"timeInterval" 
    toObject:array 
 withKeyPath:@"selection.timeInterval" 
     options:options];

      

It sets the timeInterval to NSDatePicker when the base object is changed, but does not set the base object when the NSDatePicker timeInterval value changes.

+1


source to share


3 answers


Unfortunately no. The timeInterval property for date picker isn't even noticeable. Basically, you are stuck with either setting up an action method or using a delegate's validator method to get updates on its value. Also, you will want to round it to the nearest multiple of 86400.0 (i.e. Seconds per day), since the date collector is sequentially disabled for a fraction of a second at the declared Interval. Perhaps by the time Snow Leopard rolls, this feature will be fully baked.



+1


source


Interval support is only available when you are using the graphical version of the date picker. Even then, there is no binding support for timeInterval

.



Also, depending on how you are going to use this, the UI for selecting ranges that go beyond the current month is not great in my opinion.

+1


source


1169097 explains how to implement custom bindings.

0


source







All Articles