Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

David2070

macrumors member
Original poster
May 14, 2008
79
0
UK
Hi,

I'm trying to add a handler onto a form so that I can get events when the text in a control changes and then get the changed text. I just can't seem to get the changed text when the controlTextDidChange method is called.

I've got a button and on click if I call

NSString *value = [myField stringValue];

I get the correct value of an NSTextField I have on the form.

If I call the same code from within a controlTextDidChange method though, I don't get a value.

i.e. the following doesn't work.

-(void)controlTextDidChange:(NSNotification*)aNotification {
NSString *value = [myField stringValue]
}

Can anyone help me with this as I'be been trying to fix this for hours.

Cheers.
 
Phew, after many hours finally worked this out.

The outlet was set up incorrectly.

Cheers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.