• 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: Custom NSView and NSUndoManager
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSView and NSUndoManager


  • Subject: Re: Custom NSView and NSUndoManager
  • From: Benjamin Dunton <email@hidden>
  • Date: Thu, 10 Nov 2005 05:58:33 -0500

Jim,

I was thinking about this some more this morning, and with what you are saying, tell me if this makes since. I have a text view in the application as well, and after calling [self setAllowsUndo] in the awakeFromNib:, undo/redo works. I am thinking that if I get the undo manager from the text views delegate (which also happens to be my window controller), that things might start working?

Make since?

Thanks,

Ben

On Nov 9, 2005, at 9:03 PM, Jim Correia wrote:

On Nov 9, 2005, at 9:00 PM, Benjamin Dunton wrote:

I have a bunch of custom NSView objects that can have their size changed by the user. I have the following code to handle undo/redo:

	NSResponder *resp = [window firstResponder];
	NSUndoManager *undo = [resp undoManager];

	[[undo prepareWithInvocationTarget:objClicked]
		setFrame:[objClicked frame]];
	[objClicked setFrame:newRect];

However, the undo menu does not become enabled after the above code is executed. Looking in the debugger, I do see the undo stack get the information put on it; however I can not undo my changes. I have looked at the other NSUndoManager questions, but nothing has fixed my problem.

Someone in the responder chain has to respond to the undo: and redo: messages.


Without knowing more about how the app is structured it is hard to make a specific recommendation. If you are not using the document architecture, you probably want to ensure that your window's delegate returns an undo manager from the appropriate delegate method.

Jim

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Custom NSView and NSUndoManager
      • From: Jim Correia <email@hidden>
References: 
 >Custom NSView and NSUndoManager (From: Benjamin Dunton <email@hidden>)
 >Re: Custom NSView and NSUndoManager (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Single tabview item appears off center
  • Next by Date: Re: NSTreeController Problem
  • Previous by thread: Re: Custom NSView and NSUndoManager
  • Next by thread: Re: Custom NSView and NSUndoManager
  • Index(es):
    • Date
    • Thread