On Aug 5, 2008, at 10:45 PM, Tron Thomas wrote:

One thing I found was that if I implemented an action in my controller and connected it to the button, the controller could then call the commitEditing method in response to that action. This could accomplish the same thing as pressing enter in the text field control.

Yes, that's what -commitEditing is for.

This only works though when the text field has been edited. If the text had not been edited, the user could still expect the button to cause the update. It would not be clear to them why the button wouldn't do anything when no editing had taken place.

I don't understand. If no editing is in progress, then the value in the model and the value displayed in the text field should already be in sync.

What is it that you want to happen when the user presses the button? If there's something that needs to happen above and beyond the text field's value being pushed to the model, then... just make it happen in the action method (after the -commitEditing).




One thought I had to make this relationship clear was to disable the button initially and then enable it only after the text field had been edited. I found I could do this by using the objectDidBeginEditing: method. By responding to that method I could use a binding that would affect the enabled state of the button.

In spite of this, what I also find is it that after implementing the objectDidBeginEditing: method, the action for the button that calls commitEditing no longer works. For some reason the control thinks that no editors need to commit any editing. If I remove the implementation for objectDidBeginEditing: things work fine. When I add it back in, things fail.

Sounds like your override of -objectDidBeginEditing: is not calling through to super. You're effectively replacing the implementation rather than extending it.

That said, it sounds to me like you're approaching things in a weird way.

Cheers,
Ken
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to