views:

48

answers:

1

When I press enter on an NSTextField to send what ever's in the text field, it sends it, but highlights what ever's in the NSTextField. Does anyone know how to make it so that once it sends the command in, it deletes what ever's in the NSTextField?

Thanks, Elijah

+1  A: 

If you haven't already, assign a target and action to the text field. Here's your action method:

- (IBAction)sendText: (id)sender {
    // Whatever else you were doing.
    // ...

    // Add this:
    [sender setStringValue: @""];
    // Optionally, to make it *not* the first responder:
    [[sender window] makeFirstResponder: nil];
}
Jonathan Grynspan
THANKS!!!!!!!!!
Elijah W.