• 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: Getting a reference to an NSMenuItem from another nib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a reference to an NSMenuItem from another nib?


  • Subject: Re: Getting a reference to an NSMenuItem from another nib?
  • From: Sherm Pendley <email@hidden>
  • Date: Tue, 14 Jun 2005 12:47:25 -0400

On Jun 14, 2005, at 12:13 PM, Theodore H. Smith wrote:

Yeah. It is best that the menu enabling code moves through the relevant responders. I think then that the way that Cocoa is designed is what I'll have to go with. I personally might have designed Cocoa in such a way that if-tables were unnecessary for menus...

If-tables are only necessary if you're comparing strings. If you're comparing integers - such as tags, for instance - you'd use a switch:


-(BOOL) validateMenuItem:(NSMenuItem*)anItem {
    switch([anItem tag]) {
        case 0:
            /* ... */
        case 1:
            /* ... */
        default:
            return YES;
    }
}

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
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: Getting a reference to an NSMenuItem from another nib?
      • From: Andy Lee <email@hidden>
References: 
 >Re: Getting a reference to an NSMenuItem from another nib? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Spotlight Importer for files in "Project-Based" folder
  • Next by Date: Re: Over-release *inside* framework when setting NSTextView attributes
  • Previous by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Next by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Index(es):
    • Date
    • Thread