[NSTextView] Scrolling to the top of the document via code

  • What's the obvious API I'm missing to scroll to the real top of a
    document displayed in a NSTextView?

    I have a NSTextView with a TextContainer Inset set to (6.0f,6.0f).

    When I replace the content of the NSTextView through its container
    (usual beginEditing, readFromURL, ...) code, I end up with the document
    not being displayed perfectly correctly. The document (if higher than
    the view) is scrolled bit so that the first line of text is stuck to
    the top of the scrollview instead of being 6 points away.

    I tried to use the scrollPoint or scrollRangeVisibleSomething API with
    different reasonable values, give a look at the GNUStep source code,
    change the frame of the NSTextView and its clipview, etc. with no
    success.

    The document is still scrolled by default by a small amount (and it's
    probably the TextContainer Inset height).
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today