• 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: Binding the enabled attribute of each NSPopUpButtonCell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding the enabled attribute of each NSPopUpButtonCell


  • Subject: Re: Binding the enabled attribute of each NSPopUpButtonCell
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 5 May 2009 21:30:20 -0700


On 2009 May 05, at 20:40, Dave Geering wrote:

It'd be nice if I could somehow hook into whatever is responsible for
making the menu . . .

 - (void) willAddMenuItem:(NSMenuItem *) aMenuItem
 toPopUpButton:(NSPopUpButton *)
 forObject:(id) yourObject
 {
   [aMenuItem setEnabled:[[yourObject valueForKey:@"optionAllowed"]
boolValue]];
 }

But then there would have to be another API to give it the items, and another to localize the titles. Don't wish for that.


Actually, reality is better than your dream. The hard part is to figure out which hook to use. Look at
-[NSPopUpButtonCell setMenu:]
-[NSMenu menuNeedsUpdate]


The easy part is to create the menu programatically. You start at the top, creating menu items, and add them to the menu as you go along. As you create each menu item, you set its title, target, action, enabled, representedObject, etc. It's very straightforward coding.

_______________________________________________

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


  • Follow-Ups:
    • Re: Binding the enabled attribute of each NSPopUpButtonCell
      • From: Dave Geering <email@hidden>
References: 
 >Binding the enabled attribute of each NSPopUpButtonCell (From: Dave Geering <email@hidden>)
 >Re: Binding the enabled attribute of each NSPopUpButtonCell (From: Ken Thomases <email@hidden>)
 >Re: Binding the enabled attribute of each NSPopUpButtonCell (From: Jerry Krinock <email@hidden>)
 >Re: Binding the enabled attribute of each NSPopUpButtonCell (From: Dave Geering <email@hidden>)

  • Prev by Date: Minimize All - sends what?
  • Next by Date: Re: Minimize All - sends what?
  • Previous by thread: Re: Binding the enabled attribute of each NSPopUpButtonCell
  • Next by thread: Re: Binding the enabled attribute of each NSPopUpButtonCell
  • Index(es):
    • Date
    • Thread