• 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
return press and edit text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

return press and edit text


  • Subject: return press and edit text
  • From: "J.E. Schotsman" <email@hidden>
  • Date: Wed, 30 Nov 2016 19:41:08 +0100

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 (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: return press and edit text
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Vertically Centered Colon
  • Next by Date: Re: Where are the gears?
  • Previous by thread: Re: Where are the gears?
  • Next by thread: Re: return press and edit text
  • Index(es):
    • Date
    • Thread