2 Replies
      Latest reply on Mar 8, 2019 9:19 PM by Liberty 456
      Liberty 456 Level 1 Level 1 (0 points)

        Hi all,


        I'm trying to find the easiest way to make text in a textField appear ghosted, giving it the same look as the placeholder text. I have a textfield that the user will enter text into, which then must be locked before any further functions are available. Making the textfield uneditable is easy, but getting the text to appear ghosted alludes me. Any help or pointers will be much appreciated.

        • Re: Adding placeholder type attributes to a textField stringValue
          QuinceyMorris Level 8 Level 8 (5,980 points)

          >> Making the textfield uneditable is easy


          By setting "isEditable" to false? That works, but it doesn't change the appearance of the text. I would suggest using the inherited "isEnabled" property instead, which (IIRC) will make the text appear "dimmed".


          If that doesn't work, then notice that NSTextField has a "textColor" property. You can set this to (say) light gray to make the text look disabled.


          (I answered this about NSTextField, since you talked about "stringValue", which is macOS only. UITextField also has "isEnabled" and "textColor" properties, so the answer applies to iOS if that's what you meant.)