Re: Changing NSTableView cell editing behaviour
Re: Changing NSTableView cell editing behaviour
- Subject: Re: Changing NSTableView cell editing behaviour
- From: Christoph Priebe <email@hidden>
- Date: Wed, 3 Mar 2004 15:59:15 +0100
First thank your all for your reply.
I tried Allan's method but id did not work for me because pressing
return end the editing and move the focus to the next cell. (And I don't
whant the focus move.) But Allan showed me the way. What I do now
is looking for a 'NSReturnTextMovement' in the user info of the
notification.
If I find one I create a new notification with 'NSOtherTextMovement' as
text movement and pass the changed notification to [super ...].
What do you think?
Thank you all,
Christoph
- (void) textDidEndEditing: (NSNotification*) aNotification {
// is the editing stoped by a 'return movement'?
int movement = [[[aNotification userInfo]
objectForKey:@"NSTextMovement"] intValue];
if (movement == NSReturnTextMovement) {
// copy the existing user info into a mutable dictionary...
NSMutableDictionary* newUserInfo = [NSMutableDictionary
dictionaryWithCapacity:[[aNotification userInfo] count]];
[newUserInfo addEntriesFromDictionary:[aNotification userInfo]];
// (THE MAGIC:) change the 'return' text movement to something
different...
[newUserInfo setObject:[NSNumber numberWithInt:NSOtherTextMovement]
forKey:@"NSTextMovement"];
// create a new notification with the data from the old...
aNotification = [NSNotification notificationWithName:[aNotification
name] object:[aNotification object] userInfo:newUserInfo];
}
[super textDidEndEditing:aNotification];
[[self window] makeFirstResponder:self];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.