I tried to manage the undoing for the editing of the name of the employee directly via the IB.
Indeed, as explained at the end of this chapter (in the 3d edition), managing the undoing can be handled for NSTextView directly via the IB.
So, for RaiseMan, in the IB, I selected the NSTextFieldCell corresponding to personName.
The ‘undo’ option in the attributes is already selected.
Then, I guess I have to indicate to NSTextFieldCell which is the undoManager to work with.
But : there is no method such as undoManagerForTextFieldCell for the delegate of NSTextFieldCell.
So, I guessed NSTextFieldCell would ask its window to tell who is the undoManager.
So, I use the method windowWillReturnUndoManager of the window delegate.
I set MyDocument to be the delegate of the window and then :
-(NSUndoManager *) windowWillReturnUndoManager:(NSWindow *)window
return [self undoManager];
But… finally, it does not work : the modifications of the entry corresponding to personName in the table cannot be undone.
Any guess why it does not work ?
Thank you !