Amatuer problem with NSTextField and NSButton [Solved]

  • I wrote:

    > I feel like an amatuer asking this but I have experimented and
    > searched the manuals without finding a solution.
    >
    > My application uses a user name entry window with a NSTextField and a
    > NSButton. The window is initially displayed with the name of the
    > current user in the text field. The user can then click the OK button
    > or edit the name then click the OK button.
    >
    > The problem is getting the desired action from the return key. As it
    > stands, two presses of the return key is equivalent to a click of the
    > button.
    >
    > Can anyone give me a clue about how to set it up so that only one
    > return key press is required? I am sure this is a trivial thing but
    > for some reason I just can't get the desired effect.

    It took me all of 5 minutes after posting the above to find my own
    solution. In Interface Builder, I have made the OK button the windows
    first responder. Simple but the solution was eluding me until now!