Re: why doesn't my scrollview scroll ...
Re: why doesn't my scrollview scroll ...
- Subject: Re: why doesn't my scrollview scroll ...
- From: Martin Redington <email@hidden>
- Date: Fri, 2 Jun 2006 17:18:24 +0100
Thanks Lon,
that doesn't sound very viable for me, although gives me a few
hints as to where to look.
Does anyone else know how to do this "properly"?
On 2 Jun 2006, at 16:57, Lon Giese wrote:
I had this same problem, and the docs don't really explain the
"Scrolling Machinery" very well.
I'm sure the other list members would have a better solution/
explanation (I'm all ears). But I have a work a round. I'll give
it a shot in case no one offers a better solution.
This is how I got around the problem, that the clip view doesn't
talk to the scrollers and vice versa
After programatic scroll you need to call the scrollers method to
sync up the scroller knob
-(void)setFloatValue:(float)aFloat knobProportion:(float)knobProp
then you will have another big problem: as soon as you touch the
scroller with the mouse: the view will look like it been in the
rain for about ten years, the pixels will run down the screen in
the most humorous way (unless you are a developer). Sometimes the
pixel weeping is better or worse. Try it have a good laugh then fix
it . (I'm using 10.3.9 don't know about 10.4)
To fix that, call the NSClipView method with NO immediately after
your programatic scroll.
-(void)setCopiesOnScroll:(BOOL)flag
I have this set to NO permanently and doesn't seem to make much
difference.
IMHO this problem stems from the fact that the scroller's float
value is infinitely variable but it doesn't like that. It wants a
float value that conforms exactly to it pixel position in it's view
which includes only discreet float values. the more the two vary
the worse the rain.
WooHoo the ultimate Mac App for 'The Sims 2' power users.
http://www.modthesims2.com/showthread.php?p=1239629
On Jun 2, 2006, at 6:30 AM, Martin Redington wrote:
I followed the recipe at:
http://developer.apple.com/documentation/Cocoa/Conceptual/
TextUILayer/Tasks/TextInScrollView.html
as below, but my scroll view refuses to scroll (the scroll bar
never gets activated), although I can move up and down in the
document fine.
#import "TestScrollViewController.h"
#define DEFAULT_TEXTAREA_HEIGHT 66.0f
#define DEFAULT_TEXTAREA_WIDTH 200.0f
@implementation TestScrollViewController
- (NSView *) textArea{
float textAreaFrameRectWidth = DEFAULT_TEXTAREA_WIDTH;
float textAreaFrameRectHeight = DEFAULT_TEXTAREA_HEIGHT;
NSRect textAreaFrameRect = NSMakeRect(0.0f, 0.0f,
textAreaFrameRectWidth, textAreaFrameRectHeight);
NSScrollView *scrollView = [[NSScrollView alloc]
initWithFrame:textAreaFrameRect];
[scrollView setBorderType:NSBezelBorder];
[scrollView setHasHorizontalScroller:NO];
[scrollView setHasVerticalScroller:YES];
[scrollView setAutoresizingMask:(NSViewWidthSizable |
NSViewHeightSizable)];
// doesn't seem to make any difference.
// [[scrollView contentView] setAutoresizesSubviews:YES];
NSSize scrollViewContentSize = [scrollView contentSize];
NSTextView *textArea = [[NSTextView alloc]
initWithFrame:NSMakeRect(0.0f, 0.0f, scrollViewContentSize.width,
scrollViewContentSize.height)];
[textArea setMinSize:NSMakeSize(scrollViewContentSize.width,
scrollViewContentSize.height)];
[textArea setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[textArea setVerticallyResizable:YES];
[textArea setHorizontallyResizable:NO];
[textArea setAutoresizingMask:NSViewWidthSizable];
[[textArea textContainer] setContainerSize: NSMakeSize
(scrollViewContentSize.width, FLT_MAX)];
[[textArea textContainer] setWidthTracksTextView: YES];
[scrollView setDocumentView:textArea];
return scrollView;
}
////////////////////////////////////////////////
- (void) awakeFromNib
{
NSView *view = [self viewForDictionary:nil];
// _window is an IBOutlet to the main window
[[_window contentView] addSubview:[self textArea]];
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40frontiernet.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40ucl.ac.uk
This email sent to email@hidden
_______________________________________________
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