Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[solved] Re: NSTextView auto scroll up behaviour



on 05.8.31 1:24 PM, Satoshi Matsumoto at email@hidden wrote:
> I think the key is how to customize the auto-resizing of NSTextView frame in
> order to resize by more lines than the actual increased text lines.

Yes!    I found a solution from above my comment :-).
The answer is simple.

Override  -setFrameSize: in the NSSTextView subclass.

- (void)setFrameSize:(NSSize)newSize;
{ 
int margin = [[[self enclosingScrollView] contentView] frame].size.height/2;

    newSize.width = (int)newSize.width;
    newSize.height = (int)newSize.height+margin;

    [super setFrameSize:newSize];
} 

This will bring the half window height auto-scroll up when a new line
appended at the end of the document.

Satoshi
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: NSTextView auto scroll up behaviour (From: Satoshi Matsumoto <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.