Re: Move objects above other objects in NSView
Re: Move objects above other objects in NSView
- Subject: Re: Move objects above other objects in NSView
- From: Graham Cox <email@hidden>
- Date: Tue, 28 Sep 2004 08:42:29 +1000
Are these objects other views?
They probably shouldn't be - if they can be dragged around they will
overlap, and views shouldn't overlap.
If they don't overlap then the question of front to back order doesn't
arise, so maybe your design needs a slight rethink.
Normally objects in a view like this are just kept in a list and drawn
on demand by iterating the list. Decide which end of the list is the
"front", make sure it gets drawn last, but hit tested first - i.e.
drawing and hit testing iterate in opposite directions.
Front to back order is simply a question of moving it forward and
backward in the list, it's a fairly simple matter to manipulate this.
Check out the Cocoa sample "sketch" and others, like "shadows". These
have draggable objects that overlap and have a back to front order -
you'll see they are not views but just lists of things to be drawn.
--Graham
On 27 Sep 2004, at 11:08 pm, Peter Karlsson wrote:
Dear list!
I have a NSView with a couple of objects that the user can drag
around. I
want the dragged object to be on top of the other objects. Is there a
way
to move a object above the other objects in a view?
Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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