Where does NSTextView come from?
In my OSX application i have a NSSearchField, i implemented controlTextDidChange:
which contains in key NSFieldEditor
a NSTextView
instance
- (void)controlTextDidChange:(NSNotification *)note {
NSTextView * searchField = note.userInfo[@"NSFieldEditor"];
...
}
also when asking
id firstResponder = [self.window firstResponder];
i get a NSTextView
But where is it coming from??? as NSSearchField
nor NSTextField
is NOT derived from NSTextView... also not it's cell... also i cannot find a property for it in NSSearchField
I'am using NSSearchField for sure
also when connecting the action outlet to NSSearchField
, the sender is NSSearchField
(which is ok)
- (IBAction)searchFieldCommit:(NSSearchField *)sender {
//...
}
What is this mess, why do i get NSSearchField
vs NSTextView
and how to access the NSSearchField
from NSTextView
and vice versa
Cocoa maintains a shared NSTextView called the "field editor". It is described in more detail here:
https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TextFieldsAndViews/TextFieldsAndViews.html