• 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
NSScrollView problems when scaling an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScrollView problems when scaling an NSTextView


  • Subject: NSScrollView problems when scaling an NSTextView
  • From: Keith Blount <email@hidden>
  • Date: Sun, 6 Nov 2005 03:30:59 -0800 (PST)

Hello,

I am having some strange issues when scaling an
NSTextView that have been bugging me for days - any
help of advice would be much appreciated.

I am scaling my text view using scaleUnitSquareToSize.
Note that I do not want the scaling behaviour of
TextEdit (which resizes the bounds), as I don't want
the need for a horizontal scroller. I just want the
whole text to get bigger but fit within the visible
width.

My scaling code looks like this (note that
scalePercent is a float passed in):

float currentScaleOffset = 1.0/([textView
bounds].size.width/[textView frame].size.width);
float scaleFactor =
(scalePercent/100.0)/currentScaleOffset;
NSSize scaleSize =
NSMakeSize(scaleFactor,scaleFactor);
[textView scaleUnitSquareToSize:scaleSize];

// We need to notifiy the clip view that the
// text view's frame has changed
[[NSNotificationCenter defaultCenter]
postNotificationName:NSViewFrameDidChangeNotification
object:textView];
[textView setNeedsDisplayInRect:[textView
visibleRect]];

This works great. The problem arises when I flip to
full screen mode. I do this by moving the whole text
view to another window - removing it from its current
scroll view and placing it in a different scroll view
(with a custom scroller). I then call the above code
again, as full screen mode can have a different scale
percent. At this point, there can be loads of extra
space beneath the text in the text view, or there may
be no scroller when there should be one (because there
is text to scroll). It seems that the clip view or
scroll view just isn't recognising the correct size
(height) of the text view.

Does anybody have any idea what I might be missing
here?

Many thanks in advance,
Keith




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
 _______________________________________________
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

  • Prev by Date: Looping a m4a with NSMovieView
  • Next by Date: Re: NSTask and unicode arguments
  • Previous by thread: Looping a m4a with NSMovieView
  • Next by thread: RE: NSScrollView problems when scaling an NSTextView
  • Index(es):
    • Date
    • Thread