Hey guys, I'm having trouble coming up with a solution for an NSMenu. To spill the beans, I've got an NSMenu that contains a list of subjects, based on the data of an NSArrayController. No problem there.
The problem, however, is setting the actions for the items. Say, for example, I have menu items "Biology," "Chemistry," and "Math." I want to set their actions to something like:
So that the action of, say, biology, would be:
So then it would essentially call
Problem is, I can only seem to link the action of a NSMenuItem to a single selector, which doesn't make the method calls specific enough to perform the necessary action. I could only perform something like "moveToSubject:" without the arguments. Any ideas?
The problem, however, is setting the actions for the items. Say, for example, I have menu items "Biology," "Chemistry," and "Math." I want to set their actions to something like:
Code:
- (bool)moveToSubject:(NSString *)newSubject;
So that the action of, say, biology, would be:
Code:
performAction:@selector(moveToSubject:) withArgument:[self title]
So then it would essentially call
Code:
moveToSubject:@"Biology"
Problem is, I can only seem to link the action of a NSMenuItem to a single selector, which doesn't make the method calls specific enough to perform the necessary action. I could only perform something like "moveToSubject:" without the arguments. Any ideas?