• 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
Re: 2 questions RE NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 questions RE NSScrollView


  • Subject: Re: 2 questions RE NSScrollView
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Wed, 24 Nov 2004 00:41:31 -0800

Hello...

window). This works great _except_ that when I resize the scrollable area, IB insists on placing the scroll bar at the bottom of the document area, rather than the top. I've looked all over the place, but can't seem to find a command to tell the stupid scroll bar to go to the top of the document. Hopefully there's something simple to do in IB to force this--if not, I guess I'll have to find out where the hidden code is that IB generates to make these interfaces.

What is happening is that the scroll view will always choose to go toward the orgin of the content view in this situation. The normal coordinate system of NSView places the origin in the lower left corner of the view, thus NSScrollView tends to go to the "bottom" of the content view.


The most simple solution is to make the content view of the scrollview a flipped view, assuming you are using a custom NSView subclass inside the NSScrollView and it won't cause other problems with the rest of the code in your custom NSView class.

Otherwise you can just send a scrollRectToVisible: message to the content view and provide the rect of your top left cell.


Oh, and as long as I'm asking, I'd also love it if, when I tab into a field that's not visible in the clip area, the view would update itself to place that cell into view. I'm sure there's a way to do this too, since I've seen it done, but I can't figure out how.

You can probably override editWithFrame:inView:editor:delegate:event: in an NSCell subclass to do something like this (untested, typed in mail, etc...)


- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent
{
[controlView scrollRectToVisible:aRect];
[super editWithFrame:aRect inView:controlView editor:textObj delegate:anObject event:theEvent];
}



Hope that helps,

	Louis
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >2 questions RE NSScrollView (From: John Kundert-Gibbs <email@hidden>)

  • Prev by Date: Re: Coding Standards For Objective C
  • Next by Date: Re: saving big image crashes
  • Previous by thread: 2 questions RE NSScrollView
  • Next by thread: saving big image crashes
  • Index(es):
    • Date
    • Thread