Versions, validateMenuItem: and NSMenuItem

If you find when developing in 10.7 that you get a versions menu with a NSMenuItem as one of the items, it might be worth checking to see whether you’re correctly using validateMenuItem:

This problem may happen if you return YES from validateMenuItem in a NSDocument subclass for menu items that you don’t actually control. (If you just return YES as a default for example)

If instead you return

[super validateMenuItem:item]

You should get the correct “Revert to Last Saved Version” menu item

I ran into this when I was doing testing on 10.7 and although documentation clearly states that you must call the super method in validateMenuItem: , it wasn’t immediately obvious to me what was causing the problem.

Hope this helps if you have the same problem.

Edit: This may have been fixed in OS X

This entry was posted in Macintosh, SQLEditor. Bookmark the permalink.

Leave a Reply