I have a simple application which has an NSSearchField and I want to know if the user presses, for example, an arrow key. I don’t want to subclass, because I want to modify the values of the IBOutlets in my aplication, and I can’t do that in a subclass.
EDIT
The keyUp: method that I override in my NSSearchField subclass is:
-(void)keyUp:(NSEvent*)event
{
if ([event keyCode]==36){
customers* c= [[customers alloc] init];//customers is the class where i have my IBOulets and my methods
[[self window] selectKeyViewFollowingView:self];// change the first responder
[c searcht:[self stringValue]];//here i want to call a method to make a query and change the stringValues of some IBOulets
}
}
Assign your controller as the delegate of your searchfield and implement the method:
You should then be able to receive simple NSResponder selectors such as moveDown:, moveUp:, moveLeft:, moveRight: which correspond to the arrow keys.