changing target from radio button choice
changing target from radio button choice
- Subject: changing target from radio button choice
- From: Chris Garaffa <email@hidden>
- Date: Mon, 13 Aug 2001 11:03:11 -0400
Hello,
I'm writing a Cocoa app that has an NSButton which reads from an
NSTextField and adds an item to an NSPopUpButton.
The NSButton is referred to as addFuncButton, and the text field as
functionName. The popup buttons are menu1 through menu4. Clicking
addFuncButton calls a function defined as
- (IBAction)addFunc:(id)sender;
the code for addFunc: is currently:
[menu1 addItemWithTitle: [functionName stringValue] ];
I also have a NSMatrix of radio buttons. I need to have addFunc:'s target
change based on which radio button is selected. Clicking on a radio button
calls changeMenu: which is (i've simplified the if statement for my
testing purposes):
int which=[sender selectedRow]+1;
if (which == 2)
[addFuncButton setTarget: menu2];
else
[addFuncButton setTarget: menu3];
However, clicking a radio button then clicking addFuncButton gives this
error in PB:
Aug 12 18:19:47 Function Keeper[550] *** -[NSPopUpButton addFunc:]:
selector not recognized
Aug 12 18:19:47 Function Keeper[550] *** -[NSPopUpButton addFunc:]:
selector not recognized
(yes, it repeats itself).
Can someone help me out? TIA,
Chris