• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Undo for non-document based applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Undo for non-document based applications
      • From: "K. Darcy Otto" <email@hidden>
References: 
 >Undo for non-document based applications (From: "K. Darcy Otto" <email@hidden>)

  • Prev by Date: Re: how to pass arguments by reference
  • Next by Date: Re: Wizard development on Mac
  • Previous by thread: Undo for non-document based applications
  • Next by thread: Re: Undo for non-document based applications
  • Index(es):
    • Date
    • Thread