You cannot do what you describe. The selector does nothing or does not accept any parameters - it's just the name of the message to send. You can only pass arguments when sending a message. However, controls always pass themselves as arguments to their actions, so you need a wrapper method in the following lines:
- (void)doSearchFromSearchField:(NSSearchField *)sender {
[self doSearchWithQuery:[sender stringValue]];
}
And set it as an action.
source
share