FROM : Jerry Krinock
DATE : Tue Feb 12 21:25:43 2008
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.
DATE : Tue Feb 12 21:25:43 2008
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.
| Related mails | Author | Date |
|---|---|---|
| Daniel Child | Feb 12, 19:58 | |
| Jerry Krinock | Feb 12, 21:25 |






Cocoa mail archive

