开发者

Redrawing a single rect for a line fragment in NSTextView

We have an NSTextView that needs to have single line fragments redrawn on certain ev开发者_如何学Pythonents.

Essentially, it is an outline. So when a particular line gets the message "tab out", we want to move the rect containing the glyphs rather than just inserting the tab key.

Any ideas of how to accomplish this?

Thanks!


I've watched this for any suggestions but nobody seems to be taking it.

If I understand you correctly, I'd urge you not to try messing around with the text view's drawing routines, especially when the Cocoa text system has so many hooks at so many levels?

This is essentially a paragraph-level formatting problem, isn't it? Why not just set the paragraph's NSParagraphStyle? You can do this by setting its headIndent, which is the margin ahead of the beginning of the user's language's sweep path (left-to-right, top-to-bottom, etc.).

You can intercept -insertTab: and -insertBacktab: using NSTextView's -textView:doCommandBySelector: delegate method and take that as your cue to modify the paragraph style to indent as far as you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜