I have a NSTextField to get a path. The user can type a path or drag a folder in the text field. (I subclassed NSTextField to enable drag and drop). I want to do something each time the text is edited. I tried to link an action in IB and I implemented the delegate method from NSTextFieldDelegate
-(void)controlTextDidChange:(NSNotification *)obj
But I only get a notification when the user change the text, not when it is changed programmatically.
Finally, I tried to redefine setStringValue
-(void)setStringValue:(NSString *)aString{
[self textDidChange:[NSNotification notificationWithName:NSControlTextDidChangeNotification object:nil]];
[super setStringValue:aString];
}
but I get an error
Ignoring exception raised in void run_cocoa_block(void *): *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
I guess it is because I should put something in object: but I have no idea what