Re: Undo for non-document based applications
Re: Undo for non-document based applications
- Subject: Re: Undo for non-document based applications
- From: Graham Cox <email@hidden>
- Date: Thu, 11 Dec 2008 15:54:40 +1100
On 11 Dec 2008, at 2:53 pm, K. Darcy Otto wrote:
I'm trying to get undo working with an application that is not
document-based. So far, I think I have got the operation on the
stack, but have yet to get the menu reflecting this. What I have so
far is the initialisation of undoMan (in init:), but when I get the
operation onto the stack (by the last method,
observeValueForKeyPath:), the undo menu item does not get activated.
If I add the line:
undoMan = [[NSUndoManager alloc] init];
To ensure that the menu is correctly linked to this undo manager, you
need to use:
-windowWillReturnUndoManager:
which is a delegate method of NSWindow. If you set your AppController
to be the window's delegate and implement this method to return
undoMan, you should find the menu works as you want.
hth,
Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden