On May 20, 2011, at 3:27 PM, Nick Zitzmann wrote:

> That's how to _set_ date picker elements, not _select_ them.
> 
> Anyway, I did figure out how to do this. Apparently the only way to 
> programmatically select a date picker element is to use private 
> NSDatePickerCell methods, but to unselect all date picker elements (which is 
> what I really needed to do), if you disable and then re-enable the cell, then 
> the selected element gets cleared.
> 

In addition to the usual caveats I'm sure you'll receive trying to access 
private methods, you'll also run into a more immediate usability issue.

As you've already discovered, those private methods select the element based 
not on a type identifier (year,month,day) but on an index (0,1,2) which 
specifies their location in the field. 

Probably you are wanting to always select the day or year element so the user 
can quickly change it, but you cannot reliably select the "day" part of the 
field by setting the selected index because the placement of the day element in 
that field depends on the localization option set in System Preferences 
(Language & Text > Formats). Sometimes it will be index 0, sometimes index 1, 
and so on, so that for US users, for example, your code will select the day 
element but for european users it will select the month element.

~Phil

> Unfortunately it appears that NSDatePickerCell is its own field editor, and 
> there is no apparent way to customize it without source code access. Oh well.
> 
> Nick Zitzmann
> <http://www.chronosnet.com/>
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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/dev%40getsprouted.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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