• 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: programmatically implementing segmented control
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programmatically implementing segmented control


  • Subject: Re: programmatically implementing segmented control
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 12 Feb 2008 12:25:43 -0800

On 2008 Feb, 12, at 10:58, Daniel Child wrote:

I am looking for to programmatically set up an NSSegmentedControl with menus for each segment.

That should look interesting!

When I run the program, the menu does appear correctly for each segment, but the problem is that all the items are disabled. I tried using -setEnabled when creating each of the menu items, but that didn't work. I also set the action to @selector (getUserChoice), a method in the controller code.

All the working actions I've ever seen have one argument. As you have written it, "getUserChoice" has 0 arguments. "getUserChoice:" (note the colon) has one argument. The full declaration is - (IBAction)getUserChoice:(id)sender.


Another thing which can cause menus to not be enabled is if you've implemented -validateMenuItem: or -validateUserInterfaceItem: in some object in the responder chain which is returning NO for unknown items.

Finally, remember to -setTarget: in your menu items.

_______________________________________________

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


References: 
 >programmatically implementing segmented control (From: Daniel Child <email@hidden>)

  • Prev by Date: Re: NSString ASCII filter
  • Next by Date: KVC and KVO for arrays
  • Previous by thread: programmatically implementing segmented control
  • Next by thread: Crash at THFSPlusStore::LessThan(HFSUniStr255 const&)
  • Index(es):
    • Date
    • Thread