Hello,

Today I hit an old problem again: a hit on return acts on both the default 
button and a text field that is being edited in the same window.

The text field gets the event first, then the OK button, which is probably what 
the user wants.
If I click on OK instead the text edits are ignored (which is not what I want 
if the text field contains a setting for a job started by the OK press).

I can see two solutions:

1. Make the OK button inactive while any text field is edited
2. Make sure hitting the OK button triggers the end of any text editing first.

Which is to be preferred?

If I am not mistaken either solution requires a custom delegate.
In the first case all text delegates would set a flag in my interface 
controller indicating that the OK button must be inactive (on in 
textShouldBeginEditing and off in textShouldEndEditing).
In the second case according to the Cocoa Text Architecture Guide I need to 
send the active edit text an insertNewline message. So it’s probably best to 
keep it handy in the interface controller 
(myController.activeEditText:NSTextView? set in textShouldBeginEditing and 
textShouldEndEditing).
Does this sound like a plan?

Jan E.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to