I have two `NSTextField`s: `textFieldUserID` and `textFieldPassword`.

For `textFieldPassword`, I have a delegate as follows:

```
- (void)controlTextDidEndEditing:(NSNotification *)aNotification

```

This delegate gets called when `textFieldPassword` has focus and I hit the enter key. This is exactly what I want. 

My problem is that `controlTextDidEndEditing` also gets called when `textFieldPassword` has focus and I move the focus to `textFieldUserID` (via mouse or tab key). This is NOT what I want.

I tried using `controlTextDidChange` notification (which is getting called once per key press) but I was unable to figure out how to detect enter key ( `[textFieldPassword stringValue]` does not include the enter key). Can someone please help me figure this one out?

I also tried to detect if `textFieldUserID` was a `firstResponder`, but it did not work for me. Here is the code I tried out:

```
if ( [[[self window] firstResponder] isKindOfClass:[NSTextView class]] &&
    [[self window] fieldEditor:NO forObject:nil] != nil ) {
    NSTextField *field = [[[self window] firstResponder] delegate];
    if (field == textFieldUserID) {
        // do something based upon first-responder status
        NSLog(@"is true");
    }
}

```

I sure could use some help here!