Re: validateMenuItem() not always being called
Re: validateMenuItem() not always being called
- Subject: Re: validateMenuItem() not always being called
- From: "Kyle Sluder" <email@hidden>
- Date: Sun, 18 May 2008 18:42:05 -0400
On Sun, May 18, 2008 at 4:31 PM, <email@hidden> wrote:
> I'm new to Cocoa and I created a Document-based Application with New
> Project. I added a validateMenuItem() method to my document class and it is
Methods in Objective-C are not denoted as you have done. The correct
method is -validateMenuItem:, which specifies that it is an instance
method (the - prefix) and that it accepts one argument (the colon).
> only being called when you click on the FIle menu, not any of the other
> menus. Is the document the correct place for this or do I need o add a
Please re-read the Application Menu and Pop-Up List Programming Topics
guide, which describes the exact steps that AppKit takes to validate
an automatically-enabled menu item. In particular, keep in mind the
actions that the File menu items have versus the actions of all other
menu items, and why this would cause AppKit to only invoke your
document's -validateMenuItem: method for File menu items.
> controller class? If I do need to add a controller class, how would I go
> about doing that?
This is a very fundamental concept that, if you don't understand, will
hamper your progress in learning the framework. There is ample
documentation to get you on your feet in this regard, after (or
instead of) which you may find it useful to purchase a book on Cocoa
programming. I recommend Hillegass's standard, Cocoa Programming for
Mac OS X, Third Edition (the previous editions may confuse you as
Interface Builder has drastically changed with Leopard).
Good luck, and welcome to Cocoa!
--Kyle Sluder
_______________________________________________
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