• 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: Displaying "helper text" in empty text fields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying "helper text" in empty text fields


  • Subject: Re: Displaying "helper text" in empty text fields
  • From: Charles Jolley <email@hidden>
  • Date: Fri, 19 Jul 2002 17:34:06 -0500

Hi Brian:

Thanks for the suggestion. I actually tried this already. This problem with this approach is that the controlTextDidBeginEditing notification does not get sent until the user actually changes the contents of the field. Thus, when the user clicks the field, the user finds himself editing the help text instead of an empty field. Is there some notification that gets delivered when the text field becomes first responder (well, when it get the field editor object and makes that first responder?)

Thanks,
-C

On Friday, July 19, 2002, at 02:29 PM, Brian Webster wrote:

On Friday, July 19, 2002, at 01:47 PM, cocoa-dev-
email@hidden wrote:

Basically if the actual contents of the field is empty, I want to
display a helper string in gray text until the user clicks. Then it
should be cleared.

Any ideas?

You can do a setStringValue: followed by a setTextColor: on the NSTextField to display colored text. To clear the field out when the user clicks in it, implement the method controlTextDidBeginEditing: in your text field's delegate object. You can then set the string value to @"" so that the text field is clear when it begins an editing session.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Displaying "helper text" in empty text fields
      • From: Brian Webster <email@hidden>
References: 
 >Re: Displaying "helper text" in empty text fields (From: Brian Webster <email@hidden>)

  • Prev by Date: Re: landscape printing not there by default?
  • Next by Date: Re: Need help with PackageMaker/Installer
  • Previous by thread: Re: Displaying "helper text" in empty text fields
  • Next by thread: Re: Displaying "helper text" in empty text fields
  • Index(es):
    • Date
    • Thread