Professional Web Applications Themes

Scrolling a NSScrollView to the bottom - Mac Programming

In <hraftery-2FB90A.21082003082003seagoon.newcastle.edu.au> Heath Raftery wrote: > I've embeded a NSScrollView in my app, which is filled with the > contents of a text file. This text file is typically large, and I > want to have the scroller at the bottom by default. Here's what I'm > using at present: > > NSPoint bottomOfDoent = {0, 9999999}; > bottomOfDoent = [[sMessages contentView] > constrainScrollPoint:bottomOfDoent]; > [[sMessages contentView] scrollToPoint:bottomOfDoent]; > > This works, however the scroller position widget (the blue/graphite > glob in the scroller) remains at the top, when the tabview with the > NSScollView is made visible. It goes ...

  1. #1

    Default Re: Scrolling a NSScrollView to the bottom

    In <hraftery-2FB90A.21082003082003seagoon.newcastle.edu.au> Heath
    Raftery wrote:
    > I've embeded a NSScrollView in my app, which is filled with the
    > contents of a text file. This text file is typically large, and I
    > want to have the scroller at the bottom by default. Here's what I'm
    > using at present:
    >
    > NSPoint bottomOfDoent = {0, 9999999};
    > bottomOfDoent = [[sMessages contentView]
    > constrainScrollPoint:bottomOfDoent];
    > [[sMessages contentView] scrollToPoint:bottomOfDoent];
    >
    > This works, however the scroller position widget (the blue/graphite
    > glob in the scroller) remains at the top, when the tabview with the
    > NSScollView is made visible. It goes immediately to the bottom if the
    > scroller's up arrow is clicked, but on first glance it is not obvious
    > that the bottom of the file is being shown.
    >
    > Any suggestions on getting the widget to update, or a cleaner way of
    > doing same?
    reflectScrolledClipView. But, you shouldn't be bossing the clipView
    around this way; leave it alone and let it do its job. It's the
    doentView you want to move. I take it you are saying you've got an
    NSTextView, so scrollRangeToVisible is an easy reliable way to scroll it,
    or you can use any of a number of NSView commands. Basically it's just a
    matter of RTFM. m.

    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

  2. #2

    Default Re: Scrolling a NSScrollView to the bottom

    In article <20030803092849227-0700news.la.sbcglobal.net>,
    matt neuburg <matttidbits.com> wrote:
    > In <hraftery-2FB90A.21082003082003seagoon.newcastle.edu.au> Heath
    > Raftery wrote:
    > > I've embeded a NSScrollView in my app, which is filled with the
    > > contents of a text file. This text file is typically large, and I
    > > want to have the scroller at the bottom by default. Here's what I'm
    > > using at present:
    > >
    > > NSPoint bottomOfDoent = {0, 9999999};
    > > bottomOfDoent = [[sMessages contentView]
    > > constrainScrollPoint:bottomOfDoent];
    > > [[sMessages contentView] scrollToPoint:bottomOfDoent];
    > >
    > > This works, however the scroller position widget (the blue/graphite
    > > glob in the scroller) remains at the top, when the tabview with the
    > > NSScollView is made visible. It goes immediately to the bottom if the
    > > scroller's up arrow is clicked, but on first glance it is not obvious
    > > that the bottom of the file is being shown.
    > >
    > > Any suggestions on getting the widget to update, or a cleaner way of
    > > doing same?
    >
    > reflectScrolledClipView. But, you shouldn't be bossing the clipView
    > around this way; leave it alone and let it do its job. It's the
    > doentView you want to move. I take it you are saying you've got an
    > NSTextView, so scrollRangeToVisible is an easy reliable way to scroll it,
    > or you can use any of a number of NSView commands. Basically it's just a
    > matter of RTFM. m.
    Thanks for the suggestions Matt. I'd had tried a few
    reflectScrolledClipView's in the meantime without success. Even with
    your suggestions I was unable to get it working tonight, but that could
    be put down to lack of sleep at this stage. I think what you've
    demonstrated is what I always felt - I really don't understand the MVC
    relationship well enough to do this stuff comfortably. I'll be taking
    your advice by reading a few docs.

    I've been working through O'Reilly's Building Cocoa Applications and
    Apple Cocoa NSView etc. docs, without too many lightbulbs turning on
    unfortunately. I guess, even though I am aware of the differences
    between RAD and an environment like PB/IB, that I am still expecting
    immediate results like I can achieve with Delphi and Borland C++ Builder.

    Don't suppose you have any more specific suggestions on how someone, who
    is quite confident programming in procedural and object-orientated
    environments, can unravel the
    NSView/NSTextView/NSClipView/NSDoentView/NSScrollView paradigm?

    Cheers,
    Heath

    --
    Heath
    __________________________________________________ ______
    | *Nothing is foolproof to a sufficiently talented fool* |
    | _\|/_ |
    |________________________________________m(. .)m_________|
    Heath Raftery Guest

  3. #3

    Default Re: Scrolling a NSScrollView to the bottom

    In <hraftery-7214B3.00483005082003seagoon.newcastle.edu.au> Heath
    Raftery wrote:
    > Don't suppose you have any more specific suggestions on how someone,
    > who is quite confident programming in procedural and object-
    > orientated environments, can unravel the NSView/NSTextView/
    > NSClipView/NSDoentView/NSScrollView paradigm
    Actually I think the docs are very good. Always start with the topics.
    For example the TextArchitecture concept files are really great, and
    AboutScrollViews.html tells you about scroll views. Only then should you
    read the NS***.html file, and when you do, don't forget to look at the
    superclass right the way up the hierarchy. For example, beginners fail
    to look at NSText when they are thinking about NSTextView. m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

  4. #4

    Default Re: Scrolling a NSScrollView to the bottom

    In article <20030804122130773-0700news.la.sbcglobal.net>,
    matt neuburg <matttidbits.com> wrote:
    > In <hraftery-7214B3.00483005082003seagoon.newcastle.edu.au> Heath
    > Raftery wrote:
    > > Don't suppose you have any more specific suggestions on how someone,
    > > who is quite confident programming in procedural and object-
    > > orientated environments, can unravel the NSView/NSTextView/
    > > NSClipView/NSDoentView/NSScrollView paradigm
    >
    > Actually I think the docs are very good. Always start with the topics.
    > For example the TextArchitecture concept files are really great, and
    > AboutScrollViews.html tells you about scroll views. Only then should you
    > read the NS***.html file, and when you do, don't forget to look at the
    > superclass right the way up the hierarchy. For example, beginners fail
    > to look at NSText when they are thinking about NSTextView. m.
    Just a belated thank you note Matt. I've since got my scrollview
    happening nicely and have learnt quite a bit about the Cocoa
    doentation system and text architecture. It actually turned out that
    I had a logic error earlier in my program which was giving weird results
    in the scrolling and throwing me off. For those interested, the
    following works nicely:

    [tMessages setString:myString];

    myRange.location = [myString length];
    [tMessages scrollRangeToVisible:myRange];

    where tMessages is my IBOutlet NSTextView*.

    --
    Heath
    __________________________________________________ ______
    | *Nothing is foolproof to a sufficiently talented fool* |
    | _\|/_ |
    |________________________________________m(. .)m_________|
    Heath Raftery Guest

Similar Threads

  1. Top/Bottom scrolling of table
    By Cimy13 in forum Macromedia Dynamic HTML
    Replies: 2
    Last Post: February 22nd, 01:01 PM
  2. Replies: 1
    Last Post: September 17th, 09:53 PM
  3. Replies: 2
    Last Post: July 31st, 04:20 PM
  4. Bottom margin help?
    By Chip11414 webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 25th, 01:10 AM
  5. NSScrollView for NSTextView scrolls then snaps back
    By Harry Mahoney in forum Mac Programming
    Replies: 0
    Last Post: July 16th, 09:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139