I have created my own NSTextField object:
@interface MyTitleLabel: NSTextField
@end
@implementation MyTitleLabel
- (void)mouseUp:(NSEvent *)event {
NSLog(@"up");
}
@end
then initialised it like this:
MyTitleLabel* title_field = [[MyTitleLabel alloc] init];
The problem is if I have:
[title_field setSelectable:YES];
the mouseUp
event is not triggered. But if I have it set to NO
it is. However I need the NSTextField
to be selectable
and have a mouseUp
event?
I also have an issue where - (void) rightMouseDown:(NSEvent *)event;
is not called once I have selected some text in the NSTextField
.
The functionality of text fields is implemented by NSTextFieldCell, which does most of the work, and the control which owns it, NSTextField.
In addition, while editing, the field editor comes into play.
Appleās documentation explains this relationship:
https://developer.apple.com/library/content/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TextFieldsAndViews/TextFieldsAndViews.html