Layers and Parents


#1

Whenever i move a GoObject from its layer to another, using GoLayer.AddCollection, the Parent (property) of that GoObject is changed (to null), and with it, all that consequent.
I’d like to know if there is a way to keep the parent of an object in that situation (since Parent prop. is readonly), and whether there is a way to move an object from one layer to another, without losing the Parent prop., maybe using a different method than the one i used.
thanks,
Adi


#2

You could move the parent object. Currently GoGroup does not support having its children reside in different layers.


#3

I cannot move the parent’s object.
Well, here’s the problem. according to your guide, there is no way to garentee the z-order (which object appears on top of which) in the same layer. if i want to make objects appear always on top of the others, i have to arrange them in layers.
I am using an object which inherits from GoSubGraph. call it ExSubGraph. the requirement is that an ExSubGraph, appears always on top of other ‘regular’ objects of the same parent, if they overlap.
so, if we refer to a level of an object as the amount of parents he has all the way to the document (null parent), i thought i’d put every new ExSubGraph in a layer called after its level, so overlapping ExSubGraph and 'regular’s of the same parent, always makes sure that the ExSubGraph is on top.
but when i add a new ExSubGraph as a child to another ExSubGraph, the new one creates (or enters) its own ‘higher-level’ layer, so it would be on top of other childs of its parent ExSubGraph, but then looses the ExSubGraph as his parent - and goes to be a child of the Document, and not bound by his original ExSubGraph parent.
maybe there is another suggestion as to how to solve this issue.
thanks,
Adi
BTW, i am using GoDiagram 2.2.1


#4

I’m not sure I understand your requirements. But you can control the Z-ordering of children of a GoGroup. Would this be sufficient to avoid having to use multiple layers at all?
You just have to make sure the ExSubGraph is the last object in a GoGroup. So, assuming the ExSubGraph has a Parent:
theExSubGraph.Parent.InsertAfter(null, theExSubGraph)


#5

I think playing with the InsertAfter, and InsertBefore might do the trick, although it is a bit complicated algorithm. to tell the truth, the algorithm using the layers is very small and efficient.
Maybe Northwoods might give the ability of GoGroup children be on a different layer than their parent, on later versions. just a suggestion.
Adi