RE: scaleUnitSquareToSize: weirdness (workaround found)
RE: scaleUnitSquareToSize: weirdness (workaround found)
- Subject: RE: scaleUnitSquareToSize: weirdness (workaround found)
- From: Keith Blount <email@hidden>
- Date: Thu, 6 Jan 2005 04:34:29 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Nevermind, I've found a workaround that works. I just
have to reset the text view's frame rect, like this:
NSRect frame = [[self textView] frame];
[[self textView]
scaleUnitSquareToSize:NSMakeSize(2.0,2.0)];
[[self marginView]
scaleUnitSquareToSize:NSMakeSize(2.0,2.0)];
[[self textView] setFrame:NSZeroRect]; // reset
[[self textView] setFrame:frame];
It seems a strange thing to have to do, as I'm just
changing the frame to a zero rect and then changing it
back again (and it doesn't work without the zero rect
step). I would have thought this sort of reset would
happen automatically.
Keith
---------------------------------------
FROM : Keith Blount
DATE : Thu Jan 06 12:27:27 2005
Hello,
I am trying to use scaleUnitSquareToSize: to implement
a zoom feature for my view, but I just cannot get it
to update correctly. I have tried (I think)
everything, and it is now driving me slightly crazy...
My view is a subclass of NSView, which has two
subviews: on the right, an NSTextView, and on the left
a custom view that is used for adding marginal notes
that attach themselves to the text in the text view.
The whole view is then contained inside an
NSScrollView.
This is what I am trying to do to resize (as an
initial test):
[[self textView]
scaleUnitSquareToSize:NSMakeSize(2.0,2.0)];
[[self marginView]
scaleUnitSquareToSize:NSMakeSize(2.0,2.0)];
I have tried putting this code in various places - in
the initialisers, in awakeFromNib:, and so forth - and
always get the same problem, which is this: everything
scales very nicely, but the text view is not resized
to fit the enclosing scroll view (I have the
autoresizing masks set properly). So if you type, the
text will go off the right of the view. If you resize
the window, however, the text view gets resized
correctly and everything looks fine. This suggests to
me that some message isn't being sent somewhere. I
have tried setting setNeedsDisplay: and display for
all the relevant views, but still the size doesn't get
update until you resize the window, and I have also
tried various combination of setFrame: and setBounds:,
none of which have helped.
(Incidentally, I am scaling the margin and text views
separately rather than scaling the view that holds
them - which is the scroll view's document view -
because I don't want the margin itself to double in
width.)
Can anybody see what I am missing here? It's probably
really obvious, but I would be really grateful if
someone could tell me how to get my view to update its
frame properly after the scale has been set.
Many thanks for any help in advance,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
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