Hi everybody,
so, I got a view that does a lot of custom drawing. Some of the things being drawn are text and I'd like to offer a way to edit that text.
What I'm doing now is to use NSWindow's fieldEditor:forObject: which returns an NSTextView. I can insert that into my view hierarchy, become its delegate, get the textDidEndEditing: notification, then read out the string and work with it.
All that works. But: I did R all TFM I could find, but didn't find an answer to the following question: currently, I do set the frame of the NSTextView to correspond to the text being drawn on my custom view. That works, but neither is it obvious there is a text view (Do I have to draw the keyboard focus ring manually?) nor does it behave the way I want it to as far as scrolling is concerned... When the text gets longer than what fits into the view's rect, the cursor goes into the next line and does _not_ scroll the cursor to be visible as I'd expect it to.
What I'd really want is some equivalent to an NSTextField (that is, a one line editor that always scrolls the cursor to visible). Do I have to assemble that manually or am I just not seeing something obvious?