Re: custom NSTextField issue
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.