Re: NSTextView with Undo
Re: NSTextView with Undo
- Subject: Re: NSTextView with Undo
- From: Thomas Lachand-Robert <email@hidden>
- Date: Mon, 8 Dec 2003 02:25:37 +0100
Thanks for your answer, but this doesn't work. I tried these in the
controller, since it is the delegate of the window and the text view. I
can see in the debugger that these methods are called, and they return
a non-nil object (namely [[self document] undoManager]), but it still
have this strange behavior :-(
Le 8 dic. 03, ` 01:52, Jonathan Jackel a icrit :
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.
--- Thomas LACHAND-ROBERT ---
Laboratoire de mathimatiques de l'universiti de Savoie
(LAMA :
http://www.lama.univ-savoie.fr/)
Page personnelle :
http://www.lama.univ-savoie.fr/~lachand/
_______________________________________________
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.