I have an NSTextView, which I want to use as the field editor of an NSTextField.
Since there will be other NSTextFields in the view that do not use a custom field editor, it seems I should use NSCell's method
- (NSTextView *)fieldEditorForView:(NSView *)aControlView
I can't wrap my brain around how to call this, though and have not found any examples of it in use.
NSCell's docs say that 'aControlView' is :
The view containing cells that require a custom field editor.
Which my brain is saying means 'the view this NSTextField is in', and not the NSTextField (as a subclass of NSView).
NSView *viewTheTextFieldIsIn; CustomTextView *customTextView subclass of NSTextView (the field editor) NSTextField *textField
[[textField cell] fieldEditorForView:customTextView];
makes no sense to me because its not
viewForFieldEditor:...but its on NSCell.
Would someone have mercy on me, and un-snarl my thinking?
Just thought I would answer this for the archive as I think i understand it now, (amazing what sleep will do).
The specific method call's usage can be:
CustomTextView *customTextView = (CustomTextView *)[[self.textField cell] fieldEditorForView:self.textField];
The customTextView can be used as a fieldEditor by using the window's delegate method:
-(id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client
where client can be the textField.
Then the call to
fieldEditorForView on the textField will return that CustomTextView.