Undo in a Sheet
Undo in a Sheet
- Subject: Undo in a Sheet
- From: Mark Slater <email@hidden>
- Date: Tue, 04 Sep 2001 01:55:19 -0700
I'm having a trouble enabling undo/redo for a sheet. In my app, when you
create a new document, it immediately drops down a configuration sheet
with five or six settings. The undo events are being registered as I
change values (I can see the menu name changing), but the Undo and Redo
menu items are never enabled. I've tried using validateMenuItem: in the
application delegate, the window controller for the overall document,
and the delegate for the sheet panel, but none of them get called. I've
checked the target of the undo: action, and it's the sheet panel when
the sheet is first dropped down, and when it ends. I've also tried
setting the initial first responder to the same object as the panel
delegate, with no luck.
Maybe I'm doing something wrong, but I haven't been able to find
anything that says Undo/Redo are always disabled when a sheet is active.
Do I need to make a sub-class of NSPanel to explicitly enable this? The
NSMenuValidation protocol says the target (which is the panel) is the
first object to get to validate the menu item and that it stops there
even if it doesn't validate it. Subclassing NSPanel to add the
validateMenuItem: wouldn't be a big deal... I think... but I want to
make sure nobody knows an easier way.
Thanks for any suggestions!
Mark