Challenge -editColumn:row:withEvent:select:


#1

I can not get the editColumn:row:withEvent:select to kick in. Calls to other tableView instance methods work. This method is in the tableViewController and not the myDocumentController. If this method is located within the myDocumentController it will work. What I do not like about adding it to the myDocumentController is the extra code needed to get it to work. If you leave it in the tableView Controller, you do not need to add methods undoManager, createObject. Besides technically editColumn:row:withEvent:select is suppose to work from the arrayController.

The method editColumn:row:withEvent:select gets processed since the table view scrolls to the row. The rest of the method does not work.

The documentation says: …/this method attempts to make the view at the specified column and row the first responder, which will begin editing if the view supports editing./…

First off how does one make the NSTableCellView First Responder? Then how does one make sure the NSTableCellView is editable?
What I have seen are references to [[tableView window] setInitialFirstResponder:[tableView self]]; and [[tableView window] makeFirstResponder:[tableView self]];. These do not make the cell’s object first responder.

BOOL editingEnded = [[tableView window] makeFirstResponder:[tableView self]];

if (editingEnded)
{
NSLog(@“End current edits sucessfull.”);
}
else if(!editingEnded) {
NSLog(@“Unable to end editing.”);
return;
}

// Select a row. There is no logic here yet.
NSUInteger row = 10;
[tableView editColumn:0
row:row // Row is scrolled into view but stays disabled.
withEvent:nil
select:YES];