• 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
Consistent scroll-to-visible of text view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Consistent scroll-to-visible of text view?


  • Subject: Consistent scroll-to-visible of text view?
  • From: Randall Meadows <email@hidden>
  • Date: Tue, 16 Dec 2008 11:46:42 -0700

I have a table that contains representations of various types of data. As a row is selected another view changes to show details of that data. For instance, some display images and some display text in an NSTextView.

As I change from one row to the next, I populate the detail display area with the relevant detail data. When I populate the text view, it was always displaying the text view scrolled to the bottom, presumably because that's where the insert point was left after I inserted the text into the view.

Fine, I'll just stick [notesView scrollRangeToVisible:NSMakeRange(0, 0)]; in there, after I insert the text, before it gets displayed.

BOOL wasEditable = [notesView isEditable];
[notesView setEditable:YES];
[notesView selectAll:nil];
[notesView insertText:textToDisplay];
[notesView setEditable:wasEditable];
[notesView scrollRangeToVisible:NSMakeRange(0, 0)];

Well, now it alternates between being scrolled to the beginning of the text and being scrolled to the end of the text on subsequent row selections. It'll keep alternating as long as I keep changing the selection. And, it seems to be sensitive to manual scrolling as well: If, when it's scrolled to the top, I manually scroll it to the bottom, change the selection and then come back, the alternating now picks up with it being scrolled to the top again, in an opposite phase.

What am I missing to always start the display of this newly-unhidden text view with it scrolled to the top such that the start of the text is always visible?


Thanks! randy _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Consistent scroll-to-visible of text view?
      • From: Ashley Clark <email@hidden>
  • Prev by Date: Re: Text track in QTMovie
  • Next by Date: Re: Sublclassing NSThread
  • Previous by thread: Re: Sublclassing NSThread
  • Next by thread: Re: Consistent scroll-to-visible of text view?
  • Index(es):
    • Date
    • Thread