Re: NSTextView with Undo
Re: NSTextView with Undo
- Subject: Re: NSTextView with Undo
- From: Jonathan Jackel <email@hidden>
- Date: Sun, 7 Dec 2003 19:52:22 -0500
Make your document the delegate of the text view and its window. Then
add this code to the document class:
- (BOOL)hasUndoManager
{
return YES;
}
- (NSUndoManager *)undoManagerForTextView:(NSTextView *)aTextView
{
return [self undoManager];
}
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
{
return [self undoManager];
}
The document should automatically take care of creating and
deallocating the undo manager.
Jonathan
On Dec 7, 2003, at 3:28 PM, Thomas Lachand-Robert wrote:
>
Hi all,
>
>
I'm having a problem with my NSTextView: undo doesn't work properly.
>
That is:
>
1/ when typing, nothing appears in the Undo menu;
>
2/ when pasting, cutting, etc., I get "Undo Paste", etc.: but choosing
>
these items has no effect in the text. OTOH the redo menu is updated,
>
and also the dirty dot for the window.
>
>
I have a document-based application, with a subclass of
>
NSWindowController controlling the document's window that contains
>
only one NSTextView. There is no undo code at all at the moment, but I
>
checked the "allows undo" for the text view in IB. (I tried to uncheck
>
it, but then even the Paste operations are not registered in undo, as
>
one can guess.)
>
>
What did I forget?
>
Thanks,
>
>
Thomas Lachand-Robert
>
********************** email@hidden
>
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
>
_______________________________________________
>
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.
_______________________________________________
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.