First of all i have to do this without IB and without advanced Objective-C techniques like KVO.
My problem comes from the simple fact that i can't find a way to get the whole new string value of the text field.
I'm tried using the delegate function:
- (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString
but this does not give me only the replacement string not the full string i need for validation. I can later use text
I found
- (void)textDidChange:(NSNotification *)aNotification
- (void)controlTextDidChange:(NSNotification *)aNotification
but when i get this calls it is already to late and the last text field content is already gone. So what is the best way to handle this?
And yes i did read http://stackoverflow.com/questions/527322/binding-nstextfield-to-nsnumber but it gives me no clue how to solve my problem.
All i need is a simple "- (BOOL)acceptNewValue(NSString string)" testing function. Why is everything so complicated with Cocoa it starts to feel like MFC.