Re: Lining up NSViews in NSScrollView
Re: Lining up NSViews in NSScrollView
- Subject: Re: Lining up NSViews in NSScrollView
- From: daniel <email@hidden>
- Date: Sun, 20 Feb 2005 00:45:35 -0800
You can't "put views on top of other views." You can only put views
inside other views. There must be a hierarchical relationship between
all views in your window.
You might accomplish what you are trying to do by creating a custom
subclass of NSTextView that is capable of drawing embellishments on top
of whatever the base class draws. For any views you have in mind that
have corresponding cells, you could use cells to draw their
representations on top of the text view. If they don't have cells, you
could render the views into an NSImage and then draw them on top of the
view.
If your requirements are much more complicated than that, then the
answer might involve secondary, borderless windows that are positioned
over your primary window, set up with an appropriate scrolling view
that is scrolled in sync with the main window. If you are envisioning
a limitless number of "layers" then perhaps this is your answer.
As far as I know the only way to get multiple views to overlap reliably
is to display them in separate windows that themselves overlap.
Daniel
On Feb 19, 2005, at 8:46 PM, Michael Marmarou wrote:
Hello all,
I am not sure what the best method for this is. In the main part of
my program I have a NSTextView in an NSScrollView (actually NSTextView
in NSClipView in NSScrollView), and I want to have multiple view on
top of each other in the NSScrollView. What I want to be able to do
is to draw on an NSTextView, which i assume is impossible, so I wanted
to add a view on top of it to allow the user to draw.
So my question really is, how would I go about having multiple NSView
subclasses (that have transparent backgrounds) lined up in one
NSScrollView? I have other views in mind too. The user will be able
to choose from different layers, and all layers should scroll
together.
Thanks,
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com
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