views:

388

answers:

3

Greetings,

I have a NSTextView with a sizeable quantity of text. Whenever I scroll however, the view isn't updated properly. There are some artifacts that remain at the top or the bottom of the view. It appears that the view doesn't refresh itself often enough. If I scroll very slowly the view updates correctly though. If I add a border to the view everything works perfectly, borderless view is the one that has a problem. Here's a link to a screenshot:

Thanks

+3  A: 

Looks like the text field isn't even in the scrolling-area... Are you sure something isnt overlapping it?

Daniel Kindler
I'm not sure, no. If I scroll downwards though, the text will appear, aligned with the bottom of the scroll control. The garbage will disappear, replaced with clear rendering of the text.
EightyEight
did you try re-setting up your xib? Sometimes that helps me.
Daniel Kindler
A: 

I had the same trouble some time ago. I don't remember how I solved it.

Try to place the NSTextView to another view if the superview is a custom view. Just to see what will happen.

cocoafan
I'll give that a go. Good to know that I'm not the only one with this problem though.
EightyEight
A: 

Have you set the setDrawsBackground and copiesOnScroll propertes for either the NSScrollView or the NSClipView?

The first thing I would suggest is turning off the "draws background" property of the NSScrollView:

[myScrollView setDrawsBackground:NO];

Note that this should be set on the NSScrollView, and not on the embedded NSClipView.

The following excerpt from the documentation may be relevant:

If your NSScrollView encloses an NSClipView sending a setDrawsBackground: message with a parameter of NO to the NSScrollView has the added effect of sending the NSClipView a setCopiesOnScroll: message with a parameter of NO. The side effect of sending the setDrawsBackground: message directly to the NSClipView instead would be the appearance of “trails” (vestiges of previous drawing) in the document view as it is scrolled.

e.James
Why the downvote?
e.James
I just ran across this exact problem myself. Setting `[scrollView setDrawsBackground:YES]` fixed the artifact problem. In other news, it is a very strange feeling to find your own answer when searching for a solution :)
e.James