Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo Manager is nil --- Why?

Why is [self undoManager] zero in a child window, in a doc-based app?

Should it not refer to the undo manager of its parent window? In the parent window, I get an actual address for the undo manager!

like image 321
Carelinkz Avatar asked Apr 14 '26 04:04

Carelinkz


1 Answers

The undoManageris not a member of NSWindowController. This is just a NSDocument "feature".

An excerpt from the NSDocument docs : ... A document manages its window’s edited status and is set up to perform undo and redo operations. ....

Section "Subclassing NSDocument":

.... Subclasses are also responsible for the creation of the window controllers that manage document windows and for the implementation of undo and redo. ....

The code you've written won't work on other strongly typed languages because you would send a message to an object that doesn't exist. I'm pretty sure you should have a compiler warning here.

Hope this helps,

best,

Flo

like image 115
guitarflow Avatar answered Apr 16 '26 23:04

guitarflow