CocoaDev

Edit AllPages

Hi,

I have bound an IBAction method to check if the value inside a NSTextField is “valid” (as in if it’s unique). If it’s not unique a NSAlert is sent and then I would like to set the focus back to the original textfield.

I’ve searched and found that the proper way is to go self window] makeFirstResponder: txtMarkerName]; and this works as long as you press “enter” to validate (meaning focus is returned to the desired textfield) but if you press the tab key then focus is moved to the next text field (even though the value was invalid). So how do I actually force it to go to a certain textfield regardless of if I press enter or tab before?

Any suggestions as to what I might be able to do?