• 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:" action vs. NSWindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "undo:" action vs. NSWindow


  • Subject: Re: "undo:" action vs. NSWindow
  • From: Dustin Voss <email@hidden>
  • Date: Fri, 24 Nov 2006 12:23:47 -0800

On 21 Nov 2006, at 9:51 AM, Robb Olsen-Albright wrote:

I'm having an issue with undo support in a non-document-based app.

I 'm working on converting the OS layer of a cross platform app to Cocoa.

So, we have a cross-platform undo manager in our C++ logic code. this means I don't need or want an app level NSUndoManager.
I do, however, want Undo/Redo to automatically work in dialogue text fields.


In order to do that, we have undo: & redo: methods in the Application delegate, that just reroute to the cross platform command handler.

(We also do menu validation in a validateMenuItem: method in the same app delegate.)

The problem is, NSWindow gets in the way. When the menu validation code goes through the responder chain, it gets to NSWindow and ends up using a default NSUndoManager that NSWindow provides. Then validateMenuItem gets sent to the window since it (or a delegate) implements undo:, which since the undo manager it's using doesn't have anything to undo, returns NO.

Thus, my undo/redo menu items are never enabled

One thing you could do is write a facade class that adheres to the NSUndoManager interface but actually just calls your cross-platform Undo handler. Then NSWindow can return that facade class as the undo manager.


It should work seamlessly, assuming your undo manager and NSUndoManager are compatible enough.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >"undo:" action vs. NSWindow (From: Robb Olsen-Albright <email@hidden>)

  • Prev by Date: Re: Re: How do I give a set of methods to some objects but not others?
  • Next by Date: Re: How do I give a set of methods to some objects but not others?
  • Previous by thread: "undo:" action vs. NSWindow
  • Next by thread: selection drag within nsview
  • Index(es):
    • Date
    • Thread