Hm, that didn't help much. Still:
*** -[Undo undoManager]: selector not recognized [self = 0x3089c0]
Is there any restriction in a way that not all classes can implement
NSUndpManager? The way I tried it now is exactly how Aaron described it
in his book.
> Hm, that didn't help much. Still:
>
[quoted text clipped - 3 lines]
> NSUndpManager? The way I tried it now is exactly how Aaron described it
> in his book.
Ah, I wasn't paying enough attention. My advice is still relevant, but
this error doesn't pertain to it.
The -undoManager method is not magic. You're doing [self undoManager] to
get an undo manager, but in this case self is *your* object, a simple
subclass of NSObject, and you have not written an -undoManager method, so
of course it's failing.
I believe the standard way of doing this in this sort of situation is to
ask your window for the undo manager. So if you're an NSWindowController
subclass, [[self window] undoManager] should get you a suitable undo
manager you can use.
Manni - 27 May 2005 17:57 GMT
I don't get it. :-(
Now I created a completely new project (Document-architecture).
I have a subclass of NSDocument:
@interface UndoClass : NSDocument
My way to call den Undomanager is the followin:
NSUndoManager *undoManager;
undoManager = [self undoManager];
[undoManager registerUndoWithTarget:self
selector:@selector(klick:)
object:nil];
[undoManager setActionName: @"Yes"];
But ... nothing happens! No error, the program's running fine, but no
undo is possible. It can't be that tricky to get an undomanager to work
...
Yikes!
Manni - 27 May 2005 18:00 GMT
One correction: "object:sender" ... but that doesn't change anything ...
Manni - 27 May 2005 18:59 GMT
Oh no no!! I figured it out: wrong connections in Interface Builder.
:-(
Nevertheless: thanks a lot for your help!