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

programmatically implementing segmented control


  • Subject: programmatically implementing segmented control
  • From: Daniel Child <email@hidden>
  • Date: Tue, 12 Feb 2008 13:58:20 -0500

Hi All,

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

I use a function to populate a menu with string equivalents to an enumerated set of values.
I append the items to the menu, and append the menu to the control segments.


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.

I am admittedly not clear on how to field the user choice. When the user selects, say, segment 1 item 2, is it the menu item that sends an action message? Or should be there delegation from the menu itself to the controller to notify that something has happened?

Sorry if this is basic. I've looked at the guides on NSSegmentedControl / NSSegmentedCell / NSMenu but can't see why this is happening. If anyone knows of a good tutorial on this kind of programmatic menu setup, I'd love to know about that too.

Thanks.

Daniel
_______________________________________________

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: programmatically implementing segmented control
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: Login item support for Panther, Tiger and Leopard
  • Next by Date: Re: KVO of NSObjectController vs. NSMutableDictionary
  • Previous by thread: Re: Dependent value on to-many Core Data relationship
  • Next by thread: Re: programmatically implementing segmented control
  • Index(es):
    • Date
    • Thread