Re: Scrollview sizing/positioning questions
Re: Scrollview sizing/positioning questions
- Subject: Re: Scrollview sizing/positioning questions
- From: Yann Bizeul <email@hidden>
- Date: Thu, 3 Jun 2004 16:13:23 +0200
Hi,
About the second question , here is some code as a category of NSView :
@implementation NSView (scrolling)
- (void)scrollToTop
{
[self scrollPoint:NSMakePoint(0,NSHeight([self
frame])-NSHeight([[self superview]frame]))];
}
@end
Call it on the NSScrollView's documentView:.
NSScrollView is made of :
- the NSScrollView, which contains slider and :
- an NSClipView, which is the size of the NSScrollView, minus the
slider. It clips its subview :
- Whatever view, subview of NSClipView, can be called by NSScrollView's
documentView:
I don't think this last subview should resize, since it is clipped by
NSClipView. This last one, by the way, by defaults adjust its size to
the SCScrollView frame (minus scrollers)
Hope that's clear :-/
Le 2 juin 04, ` 15:44, Don Rainwater a icrit :
>
[Xcode 1.2, Mac OS X 10.3.4]
>
>
The amount of information that I'm trying to display in a window
>
finally grew to where I needed to put it all in a scrollview. No
>
problem, I thought. In Interface Builder, I selected all of the text
>
fields and boxes, then selected Layout->Make subviews of->Scroll View.
>
This creates a scrollview that is *just* big enough to enclose all of
>
the objects within. It's a little tight, so I grab the edges of the
>
scrollview and make it bigger. Then I tried to move the enclosed
>
objects around. Grabbed a text field, dragged it to the right, it
>
starts to disappear.
>
>
Ok, so putting things into a scrollview actually puts them into an
>
NSView inside an NSScrollView, and resizing the scrollview doesn't
>
resize the view inside. But I found that I cannot reliably grab the
>
edges of the view and resize it like I did with the scrollview. In
>
some cases the edges disappear, but this is not entirely predictable.
>
>
What I discovered was that I had to set the auto-sizing bars to
>
springs on the inside of the scrollview AND on the inside of the view.
>
This allowed me to grow the view to the size that I need, move the
>
objects inside around, and add additional items to it. To get the
>
scrollview to scroll, I then had to change the springs of the view
>
back to bars, so that the view didn't resize itself when the enclosing
>
scrollview's size changed. This SORT OF makes sense.
>
>
After all that, the questions:
>
>
1. For getting a bunch of text fields and other items into a
>
scrollview, is this the "right" process, or did I construct a complex
>
solution to a problem with a simpler answer?
>
>
2. The scrollview works, but it starts at the bottom left of the view.
>
How can I make it start at the top right? And why would it default
>
to the bottom left anyway?
>
>
--
>
Don Rainwater
>
_______________________________________________
>
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.
>
>
>
--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
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.