Re: NSTextField delegate how to?
Re: NSTextField delegate how to?
- Subject: Re: NSTextField delegate how to?
- From: Ricky Sharp <email@hidden>
- Date: Tue, 27 Sep 2005 19:04:53 -0500
On Sep 22, 2005, at 10:01 PM, .::welemski::. wrote:
I can't get my NSTextField's delegate to work. :(
I read the documentation and I followed some examples on the net,
still I am unable to
make it work.
Can anyone give me an example on how to make
"-(void)textDidChange:(NSNotification*)aNotification" delegate to
work?
Just a simple example will do, like printing on the NSLog( @ "Text
did change").
I just added some code to do this and am also puzzled to why it's not
working.
Here's my method I added to a controller:
- (void)nameDidChange_II:(NSNotification*)aNotification
{
NSBeep();
}
First, I tried adding the controller as an observer like so:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(nameDidChange_II:)
name:NSTextDidChangeNotification
object:nameField_II];
where nameField_II is a connected IBOutlet (NSTextField*)
nameDidChange_II: was never called, so I removed the addObserver code
and instead set up the controller as the field's delegate. Still no
luck.
Has there been something changed in Tiger that would cause this to
fail? The last time I played around with such code was in Panther.
Also, all the code examples I've found use either of the two
approaches above. And, I don't see any example code setting the
notification's object to the field editor; we shouldn't have to do
that, right? I believe the object is always the actual text field.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden