• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using -scrollRectToVisible: in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using -scrollRectToVisible: in NSTextView


  • Subject: Using -scrollRectToVisible: in NSTextView
  • From: Jeremy Dronfield <email@hidden>
  • Date: Tue, 6 Jul 2004 16:12:20 +0100

Are there any known issues with sending -scrollRectToVisible to NSTextView (or subclasses)?

I'm trying to get my text view to remember the visible rect for the last text file viewed, so that it can scroll back to that place when the same file is next loaded. I'm doing this:

//load the text into the text view
[[textView textStorage] replaceCharactersInRange:NSMakeRange(0, [[textView textStorage] length]) withAttributedString:theText];
//retrieve the last visible rect for that particular text file
NSRect scrollRect = [self getRectForNextFile:file];
NSLog(@"%@", NSStringFromRect(scrollRect));
[textView scrollRectToVisible: scrollRect];

The log outputs a valid rect - along the lines of {0, 1254, 425, 645} - but the scrolling behaviour is either erratic or non-existent. If the previously viewed file was very short (i.e. no scroller showing), no scrolling occurs when a long file loads, whereas when switching between long files, scrolling does happen - though not always to the right place.

I've also tried using -scrollPoint:, with exactly the same results. Does anyone have any experience of this, and if so, could they offer any advice?

Regards,
-Jeremy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Using -scrollRectToVisible: in NSTextView
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Implementing Hidden text
  • Next by Date: Re: erasing, redrawing NSBezierPath into and NSImage problem
  • Previous by thread: Re: NSTimer questons
  • Next by thread: Re: Using -scrollRectToVisible: in NSTextView
  • Index(es):
    • Date
    • Thread