May have solved it myself, but thanks for you suggestion.
For those who may struggle with this, here is what I did.
When I discovered what the window's field editor is all about I was convinced that is what I needed to use. I guess each window has a default field editor which is a TextView that sits around and handles the text editing functions for all of the text related items in the window. Sort of an invisisble TextView that does the heavy lifting. It's behavior can be modified via it's delegate methods.
1) Subclass textView and override the textView:doCommandBySelector: method as such:
- (BOOL)control
NSControl *)control textView
NSTextView *)fieldEditor doCommandBySelector
SEL)commandSelector {
BOOL retval = NO;
if (commandSelector == @selector(insertNewline
) {
retval = YES;
[fieldEditor insertNewlineIgnoringFieldEditor:nil];
}
return retval;
}
2) Override the window delegate's windowWillReturnFieldEditor:toObject: method. Here's my code:
-(id)windowWillReturnFieldEditor
NSWindow *)sender toObject
id)anObject
{
if ([anObject isKindOfClass:[ListBoxControl class]])
{
return [[[myTextView alloc] init] autorelease];
}
return nil;
}
In my case the only class instance that I wanted to modify the behavior for was an instance of class ListBoxControl. If the object requesting text editing services is any other than of class type ListBoxControl, then my custom field editor is not used and the default field editor is used.