NSTextField delegate textDidChange:
NSTextField delegate textDidChange:
- Subject: NSTextField delegate textDidChange:
- From: Richard Adams <email@hidden>
- Date: Sat, 24 Nov 2001 15:51:08 -0800 (PST)
I need to do some processing after each key press in a
text edit field.
It seemed like the way to go was to use the
textDidEndEditing method sent to the delegate of an
NSTextField. I saw in the NSTextField.html docs that:
"An NSTextField can be assigned a delegate, who is
then informed of delegate messages sent by the
window's field editor, such as textShouldEndEditing:."
OK, I add
- (void)textDidChange:(NSNotification *)aNotification
{
NSBeep();
}
to my controller object and used IB to connect the
delegate field of the NSTextField to the controller
object.
But this method never is called.
The controller object is already acting as a delegate
of the application and the delegate method in that
case is working just fine, so it's not like I
completely don't get the delegate concept.
Also, I checked in the debugger and the NSTextObject's
delegate is set to my controller object.
Any suggestions on what I could be doing wrong?
P.S. What I'm trying to accomplish is to have two text
fields in my UI that are "coordinated". That is, when
one changes the other maintains a certain relationship
to the other. The textDidChange delegate method seemed
like the obvious place to accomplish this.
Richard
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1