Changeset 623 for trunk/Cocoa/Pester/Source
- Timestamp:
- 03/02/10 08:04:16 (15 years ago)
- Location:
- trunk/Cocoa/Pester/Source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSAlarmSetController.m
r622 r623 627 627 @end 628 628 629 630 629 @implementation PSAlarmSetController (NSWindowNotifications) 631 630 … … 664 663 } 665 664 666 static BOOL completingTimeDate = NO;667 static NSString *lastTimeDateString = nil;668 669 - (void)controlTextDidBeginEditing:(NSNotification *)notification;670 {671 NSControl *control = [notification object];672 673 if (control != timeOfDay)674 return;675 676 [lastTimeDateString release];677 lastTimeDateString = [[[[notification userInfo] objectForKey:@"NSFieldEditor"] string] copy];678 }679 680 665 - (void)controlTextDidChange:(NSNotification *)notification; 681 666 { 682 667 // NSLog(@"UPDATING FROM controlTextDidChange: %@", [notification object]); 683 if ([notification object] == timeDate) {684 if (!completingTimeDate) {685 NSText *fieldEditor = [[notification userInfo] objectForKey:@"NSFieldEditor"];686 NSString *editingString = [fieldEditor string];687 if ([editingString length] > [lastTimeDateString length])688 completingTimeDate = YES;689 [lastTimeDateString release];690 lastTimeDateString = [editingString copy];691 if (completingTimeDate) {692 [fieldEditor complete: nil];693 completingTimeDate = NO;694 }695 }696 }697 668 [self update: [notification object]]; 698 }699 700 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;701 {702 if (control != timeDate)703 return NO;704 705 if (commandSelector == @selector(moveDown:)) {706 completingTimeDate = YES;707 [textView complete: nil];708 completingTimeDate = NO;709 return YES;710 }711 712 return NO;713 669 } 714 670 -
trunk/Cocoa/Pester/Source/PSDateFieldEditor.m
r622 r623 11 11 12 12 @implementation PSDateFieldEditor 13 14 - (void)insertText:(id)insertString; 15 { 16 [super insertText: insertString]; 17 [self complete: nil]; 18 // XXX if we *do* successfully complete, need to delete remainder 19 // XXX example: in "today", select "t" then retype it 20 } 21 22 - (void)moveDown:(id)sender; 23 { 24 [self deleteToEndOfLine: sender]; 25 [self complete: sender]; 26 } 27 28 @end 29 30 @implementation PSDateFieldEditor (NSCompletion) 13 31 14 32 - (NSRange)rangeForUserCompletion;
Note:
See TracChangeset
for help on using the changeset viewer.