Re: NSTableView custom behavior
Re: NSTableView custom behavior
- Subject: Re: NSTableView custom behavior
- From: John Morgan <email@hidden>
- Date: Thu, 22 Dec 2005 23:22:37 -0800
Oops,
I can't seem to post without correcting myself... the textChanged
method should look like:
- (void)textChanged:(NSNotification *)note {
NSEvent *theEvent = [NSApp currentEvent];
if ([theEvent type] == NSKeyDown) {
unichar keyDownCharacter = [[theEvent
charactersIgnoringModifiers] characterAtIndex:0];
if ([[[note object] superview] superview] == tableView) {
if (![arrayController canSelectNext] && [tableView
columnAtPoint:[[note object] frame].origin] == [tableView
numberOfColumns] -1 && keyDownCharacter == NSTabCharacter) {
NSManagedObject *newRow = [NSEntityDescription
insertNewObjectForEntityForName:[arrayController entityName]
inManagedObjectContext:managedObjectContext];
[arrayController insertObject:newRow
atArrangedObjectIndex:[[arrayController arrangedObjects] count]];
[tableView editColumn:0 row:[tableView selectedRow]
withEvent:nil select:YES];
}
}
}
}
Actually inserting the object into the managedObjectContext would be
helpful. Sorry about that.
John Morgan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden