• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to use a button to update an application with a text field value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use a button to update an application with a text field value


  • Subject: Re: How to use a button to update an application with a text field value
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 5 Aug 2008 23:58:42 -0500

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to use a button to update an application with a text field value
      • From: Tron Thomas <email@hidden>
References: 
 >How to use a button to update an application with a text field value (From: Tron Thomas <email@hidden>)

  • Prev by Date: Re: NSDocument opening folders
  • Next by Date: Re: CGGStackRestore: gstack underflow
  • Previous by thread: Re: How to use a button to update an application with a text field value
  • Next by thread: Re: How to use a button to update an application with a text field value
  • Index(es):
    • Date
    • Thread