NSScrollView how to scroll to top

  • Hi,

    I have a NSScrollView, and when I load up my main window,

    the scrollview always Scrolls to the bottom of the view, I would like
    to make
    It so that the ScrollView starts at the top.

    So how do I make the NSScrollView Scroll to the top automatically?

    Thanks,
    Matt
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On 28.03.2004, at 21:01, Matt Jaffa wrote:

    > Hi,
    >
    > I have a NSScrollView, and when I load up my main window,
    >
    > the scrollview always Scrolls to the bottom of the view, I would like
    > to make
    > It so that the ScrollView starts at the top.
    >
    > So how do I make the NSScrollView Scroll to the top automatically?

    Look at the NSScrollView documentation (- contentView) this one
    returns a NSClipView,
    then look at its scrollToPoint method.

    Call this stuff in the awakeFromNib method of your controller.

    I am not sure at the moment if you have to call NSScrollViews
    reflectScrolledClipView
    method, I'd expect that NSClipView does this automatically.

    HTH, Bjoern
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On Mar 28, 2004, at 12:09 PM, Bjoern Kriews wrote:

    >> I have a NSScrollView, and when I load up my main window,
    >>
    >> the scrollview always Scrolls to the bottom of the view, I would like
    >> to make
    >> It so that the ScrollView starts at the top.
    >>
    >> So how do I make the NSScrollView Scroll to the top automatically?
    >
    > Look at the NSScrollView documentation (- contentView) this one
    > returns a NSClipView,
    > then look at its scrollToPoint method.
    >
    > Call this stuff in the awakeFromNib method of your controller.
    >
    > I am not sure at the moment if you have to call NSScrollViews
    > reflectScrolledClipView
    > method, I'd expect that NSClipView does this automatically.

    Isn't it just easier to do this?

    - (void)awakeFromNib
    {
    [[mScrollView verticalScroller] setFloatValue:1.0];
    }

    Seth Willits
    ------------------------------------------------------------------------
    ---
    President and Head Developer of Freak Software - http://www.freaksw.com
    REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic
    Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

    Friendship is a beautiful thing. "The best and most beautiful things in
    the
    world cannot be seen or even touched - they must be felt with the
    heart."
        -- Hellen Keller
    ------------------------------------------------------------------------
    ---
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • Hmmm  trying to figure out
    how to get all this Scrolling working is not fun,

    Is there a way in interface Builder to save it or set it to be at the
    top when it loads,
    if this can't be done than that sucks, and surprised no one else has
    complained about this.

    Who want the NSScrollView to start at the bottom?

    Matt

    On Mar 28, 2004, at 1:52 PM, Seth Willits wrote:

    >> reflectScrolledClipView
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On Mar 28, 2004, at 1:13 PM, Matt Jaffa wrote:

    > Hmmm  trying to figure out
    > how to get all this Scrolling working is not fun

    Did you not try the method I posted? It's a single line of code.

    Seth Willits
    ------------------------------------------------------------------------
    ---
    President and Head Developer of Freak Software - http://www.freaksw.com
    REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic
    Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

    "There are 10 types of people in this world - those that understand
    binary
    and those that don't."
    ------------------------------------------------------------------------
    ---
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On 28. Mar 2004, at 23:13, Matt Jaffa wrote:

    > Is there a way in interface Builder to save it or set it to be at the
    > top when it loads, if this can't be done than that sucks, and
    > surprised no one else has complained about this.

    If the embedded NSView uses a flipped coordinate space, then it will
    actually initially show the top of the view -- although this might not
    be helpful in your situation, but that might be why no-one has
    complained :)

    ** Cocoa FAQ: <http://www.alastairs-place.net/cocoa/faq.txt> **
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • Le 28-mars-04, ` 23:13, Matt Jaffa a icrit :

    > Hmmm  trying to figure out
    > how to get all this Scrolling working is not fun,
    >
    > Is there a way in interface Builder to save it or set it to be at the
    > top when it loads,
    > if this can't be done than that sucks, and surprised no one else has
    > complained about this.
    >

    Content view size if often related to document size of which size if
    often read from default page set-up size when the document is a new one
    and from the document data file if reading an old one.
    So there is little meaning to hardcode the content size in
    InterfaceBuilder because it would be overwritten at runtime anyway,
    this is why it doesnt' suck and that few people complain about that.

    > Who want the NSScrollView to start at the bottom?
    >

    NSScrollView doesn't start at the "bottom": it starts at the origin,
    and for a non-flipped view the origin is bottom-left.

    So, first check that - in the context of your application - you don't
    need to flip your content view first.

    Pascal Pochet
    <p3consulting...>
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
previous month march 2004 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 31        
Go to today