I have a NSDatePicker (NSDatePicker* datePicker)
, and set its delegate as the main application (self
). I programmed as follows.
Make
self
datePicker delegate[[datePicker cell] setDelegate:self];
Set
datePickerAction:
to be called when control is clicked.[datePicker setAction:@selector(datePickerAction:)];
This is the method.
- (IBAction)datePickerAction:(id)sender
{
if( [[[NSApplication sharedApplication] currentEvent] modifierFlags] &
NSShiftKeyMask )
NSLog(@"shift pressed %@", [datePicker dateValue]);
else
NSLog(@"hello %@", [datePicker dateValue]);
}
The problem is that delegation doesn't seem to work when I click the date in the NSDatePicker calendar.
- Q : What's wrong with this delegation? The target/action method works fine.
- Q : What document can I use for what delegation method is supported for NSDatePicker?