Re: switching text field between editable and non-editable
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