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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to