Permalink
Browse files

When the stepper isclicked the date picker's last selected segment is…

… selected and the date picker becomes first responder.
  • Loading branch information...
1 parent 50070e0 commit bedf7a0f22cf23df485275e1773f5f626caf61e8 @Me1000 Me1000 committed Dec 18, 2009
Showing with 10 additions and 2 deletions.
  1. +10 −2 DatePicker.j
View
@@ -45,6 +45,7 @@ CPLogRegister(CPLogConsole);
//used from the input manager migrations
id activeDateSegment @accessors;
+ id prevActiveDateSegment @accessors;
id superController @accessors;
BOOL _dontsetfirsttome;
@@ -365,6 +366,7 @@ CPLogRegister(CPLogConsole);
// console.log("resign");
// [[self window] selectNextKeyView:self];
//[[self window] sendEvent:anEvent]; //it doesn't work unless the event is sent twice... idk why.
+ [self setPrevActiveDateSegment:[self activeDateSegment]];
[self setActiveDateSegment:nil];
//_dontsetfirsttome = NO;
[[CPNotificationCenter defaultCenter] postNotificationName:"datePickerDidLoseFocusNotification" object:superController userInfo:nil];
@@ -555,8 +557,7 @@ CPLogRegister(CPLogConsole);
- (void)keyDown:(id)anEvent
{
- [self interpretKeyEvents:anEvent];
-
+ [self interpretKeyEvents:anEvent];
}
-(void)interpretKeyEvents:(id)anEvent
@@ -639,6 +640,13 @@ CPLogRegister(CPLogConsole);
- (void)stepperAction:(id)sender
{
+ //if the stepper is clicked and the date picker isn't active make it active.
+ //if the date picker was previously selected then select that segment
+ //otherwise select the first one.
+ //FIX ME: the stepper needs to be clicked twice before the value changes.
+ if(!activeDateSegment)
+ [self setActiveDateSegment:(prevActiveDateSegment) ? prevActiveDateSegment : [segments objectAtIndex:0]];
+
var newValue = [_theStepper intValue];
//[self setActiveDateSegment:[superController currentFocusedSegment]];

0 comments on commit bedf7a0

Please sign in to comment.