0
votes

I have several NSTextField that are used on a dialog created as an NSWindow and which is displayed via:

[NSApp runModalForWindow:dialog]

My problem is that if a user clicks in the NSTextField, edits the value and then clicks the dialogs DONE button which closes the dialog via:

[NSApp stopModal]

The NSTextField doesn't get any of the delegate methods indicating editing will end or has ended and the value is not persisted. I would rather not persist the values continuously in:

controlTextDidChange:aNotification

I'm not clear why if the NSTextField has firstResponder status given that it is being edited, and then loses it, why it doesn't get any delegate methods. Is there some other way to detect this.

1
Which delegate method specifically?rocky
-(BOOL)control:textShouldEndEditing:Cliff Ribaudo

1 Answers

0
votes

What fixed this was changing this:

[self resignFirstResponder];

to this:

[self makeFirstResponder:nil];

By doing that the text field on the modal window that currently had focus got the message. I'm not sure why resignFirstResponder doesn't work but setting it to nil doe, but there you have it.