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

Re: switching text field between editable and non-editable


  • Subject: Re: switching text field between editable and non-editable
  • From: Charles Srstka <email@hidden>
  • Date: Wed, 31 May 2017 15:07:41 -0500

> On May 31, 2017, at 2:18 PM, J.E. Schotsman <email@hidden> wrote:
>
>> On 31 May 2017, at 20:59, Charles Srstka <email@hidden <mailto:email@hidden>> wrote:
>>
>> Does setting its needsDisplay property to true have any effect?
>>
>> Charles
>
> No. I’ve also tried
>
> myTextField.superview!.setNeedsDisplay( myTextField.frame )
>
> in order to get the background redrawn but again I keep seeing the white text background.

Try setting isBordered and isBezeled to false as well and you should probably get a clear background.

Note that this won’t work if the insertion point is in the text field, because when that’s the case, you’re actually seeing the field editor, not the text field, and the field editor will still have the white background. So you probably want to end editding first. If you’re using bindings to populate the field, this is easy; just send commitEditing() to the NSObjectController or NSViewController that the text field is bound to. Otherwise, you’ll have to do it the old-fashioned way with NSWindow.makeFirstResponder(_:) (or NSWindow.endEditing(for:) if that won’t work for whatever reason).

Charles

_______________________________________________

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

References: 
 >switching text field between editable and non-editable (From: "J.E. Schotsman" <email@hidden>)
 >Re: switching text field between editable and non-editable (From: Charles Srstka <email@hidden>)
 >Re: switching text field between editable and non-editable (From: "J.E. Schotsman" <email@hidden>)

  • Prev by Date: Re: switching text field between editable and non-editable
  • Next by Date: Re: switching text field between editable and non-editable
  • Previous by thread: Re: switching text field between editable and non-editable
  • Next by thread: Re: switching text field between editable and non-editable
  • Index(es):
    • Date
    • Thread