• 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: custom NSTextField issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom NSTextField issue


  • Subject: Re: custom NSTextField issue
  • From: Stefan Schüßler <email@hidden>
  • Date: Sat, 2 Aug 2003 17:49:37 +0200

After several hours of trial and error I've found a solution myself :)

In case of leaving a NSTextField without changing its content, the textShouldEndEditing method is _not_ called. However, the textDidEndEditing method _is_ called when leaving the text field, whether or not the text has changed.

Now I've successfully subclassed a NSTextField to display some status-text in gray when the field is empty.

Stefan

Am Samstag, 02.08.03 um 10:43 Uhr schrieb Stefan Sch|_ler:

I'm trying to customize a NSTextField the way the search fields work in Mail and Safari. I.e. it should display a gray text if the field is (left) empty and delete this text if the user enters the field.

Subclassing NSTextField and overriding becomeFirstResponder works fine in the latter case. However, overriding resignFirstResponder does not work as expected, as a NSTextField yields control (first responder) as soon as it is activated. Therefore I'm unable to tell when the user is leaving the text field. NSTextField's textShouldEndEditing method does now work either since it is only called if the user has actually entered some text. Tabbing in and out the text field does not send this message.

Any suggestions?
_______________________________________________
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.

References: 
 >custom NSTextField issue (From: Stefan Schüßler <email@hidden>)

  • Prev by Date: Re: Optimizing for code size
  • Next by Date: NSTextView & Leaking Memory
  • Previous by thread: custom NSTextField issue
  • Next by thread: NSTableView Question
  • Index(es):
    • Date
    • Thread