• 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
How do I change the default scrolling behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I change the default scrolling behavior


  • Subject: How do I change the default scrolling behavior
  • From: Timothy Standing <email@hidden>
  • Date: Tue, 30 Apr 2002 11:16:09 -0700

I have a custom NSView inside a NSScrollView in my applications main window. The NSScrollView is set so it resizes whenever the window is resized, but my custom view does not.

I want to make it so that when the user changes the window size, the point in my custom view which was at the top left corner of the NSScrollView does not change. In other words if an image in my custom view is displayed at the top left corner of the window, it remains in the same position (relative to the top left of the window) after the window has been resized. (This is exactly the way that Project Builder handles resizing source code windows.)

The default behavior of NSScrollView is for point at the bottom left of my custom view to remain in the same position relative to the bottom left corner of the window. I assume that the default behavior arises because the origin of my views visibleRect is unchanged when the NSScrollView is resized.

I have code which figures out how much I need to change the the origin of my custom view's visibleRect. I have tried to get the NSClipView which contains my custom view to move my view by calling [self scrollPoint] or by calling [[self superview] scrollToPoint: scrollPoint] from inside my custom view's implementation of resizeWithOldSuperviewSize. Neither of these mechanisms work particularly well as they result in my custom view being called to draw itself twice whenever the window is resized and because they can result in the scroll bar getting out of sync with the display of my custom view.

It seems therefore that I am missing something really obvious here. Does anyone know the correct way to implement this.

Thanks in advance,

Tim Standing
SoftRAID, LLC
_______________________________________________
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: How do I change the default scrolling behavior
      • From: David Vierra <email@hidden>
  • Prev by Date: Re: DOCK: CFMessagePortSendRequest returned (-1|-2)
  • Next by Date: Changing Icons
  • Previous by thread: Re: Recognizing return/enter in TextField
  • Next by thread: Re: How do I change the default scrolling behavior
  • Index(es):
    • Date
    • Thread