Scrolling a view containing two subviews (NSTextView weirdness)
Scrolling a view containing two subviews (NSTextView weirdness)
- Subject: Scrolling a view containing two subviews (NSTextView weirdness)
- From: Keith Blount <email@hidden>
- Date: Thu, 6 Jan 2005 15:53:26 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I have a view that consists of an NSTextView and a
margin on the left of it that can be used to add notes
(kind of similar to Stickies). I'm having problems
setting this up in a scroll view in a way that works,
and I would be grateful for any pointers or advice on
this.
At the moment, I have subclassed NSView and added the
margin view and NSTextView as subviews. This view is
set to receive NSViewFrameDidChangeNotifications, and
when it receives one from the text view, it resizes to
accommodate it.
All this works fine - the view resizes and scrolls as
it should. The problem is that the NSTextView acts
very strangely. If I set its autoresizing mask to
NSViewWidthResizable and NSViewHeightResizable
(remembering it is a subview of an NSView which also
has both of these masks set and is the document view
of the scroll view), it goes nuts whenever the view is
resized. I set the background colour to red to check
this out, and whilst the width works fine, the height
wobbles about all over the place, even disappearing
off the top of the view at times.
I don't really understand why this should be - if you
just set an NSTextView with the width and height
resizable masks set as the document view of an
NSScrollView, it works perfectly. So I don't get why
when it goes crazy when it is the subview of an NSView
(my NSView is flipped, by the way, as it should be).
Has anyone got any ideas about where I might be going
wrong? I have searched the archives and found lots of
similar problems (for instance, people trying to align
two text views in one scroll view), but no solutions.
Similarly, I can't find any examples - I thought the
TextSizingExample's two-column view might help, but it
doesn't as it doesn't use a scroll view; similiarly,
TextEdit's multiple page view works quite differently
to what I am trying to do... And yet I feel sure this
should be quite simple and that I am missing something
obvious.
Many thanks for any suggestions or help,
Keith
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.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