Hi all,
I am trying to create a custom control (an NSView subclass) that hosts a number of other controls that are created on the fly and positioned on the view at runtime.
One of these controls is an NSTextField which is created in the init method, with code below:
My class implements the NSTextFieldDelegate protocol.
The problem is that the controlTextDidChange method is never called when I type in the field. I have checked that the delegate is assigned correctly and I have even tried adding my class as an observer of the NSControlTextDidChangeNotification but nothing works, it is as if my text field is not posting a text changed notification when I type in it.
What have I missed?
I am trying to create a custom control (an NSView subclass) that hosts a number of other controls that are created on the fly and positioned on the view at runtime.
One of these controls is an NSTextField which is created in the init method, with code below:
Code:
_addressBar = [[NSTextField alloc] initWithFrame: ... ];
[_addressBar setBordered:NO];
[_addressBar setEditable:YES];
[_addressBar setSelectable:YES];
[_addressBar setFont:newFont];
[_addressBar setTarget:self];
[_addressBar setAction:@selector(_textFieldAction:)];
[_addressBar setDelegate:self];
[self addSubview:_addressBar];
My class implements the NSTextFieldDelegate protocol.
The problem is that the controlTextDidChange method is never called when I type in the field. I have checked that the delegate is assigned correctly and I have even tried adding my class as an observer of the NSControlTextDidChangeNotification but nothing works, it is as if my text field is not posting a text changed notification when I type in it.
What have I missed?