• 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
switching text field between editable and non-editable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

switching text field between editable and non-editable


  • Subject: switching text field between editable and non-editable
  • From: "J.E. Schotsman" <email@hidden>
  • Date: Wed, 31 May 2017 20:51:40 +0200

Hello,

I have a hard time achieving what the message title says.
Depending on user settings I want a text field to be either editable or non-editable.

I’ve tried this:

if makeEditable
	{		myTextField.isEditable = false
			myTextField.drawsBackground = false }
else
	{		myTextField.isEditable = true
			myTextField.drawsBackground = true }

Setting the editable property has the desired effect, but setting drawsBackground has no effect.
Also I need to move the focus to another control (if myTextField has focus) or else the insertion point indicator keeps blinking.
I’ve tried this:

			if  myTextField.window!.firstResponder === myTextField
				{
				myTextField.window!.selectPreviousKeyView(nil)
				}

but no cigar. firstResponder always is some button even when I see the insertion point indicator blinking.
Can some please shed some light on this?

TIA

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: switching text field between editable and non-editable
      • From: Ken Thomases <email@hidden>
    • Re: switching text field between editable and non-editable
      • From: Charles Srstka <email@hidden>
  • Prev by Date: Re: Process.launch() in Swift
  • Next by Date: Re: switching text field between editable and non-editable
  • Previous by thread: Re: Process.launch() in Swift
  • Next by thread: Re: switching text field between editable and non-editable
  • Index(es):
    • Date
    • Thread