Who is on top

If I have two sibling components, and I want to find out if one is on top of the other in the zorder, is this the correct way to do it?

if (getParentComponent()->getIndexOfChildComponent(other) > getParentComponent()->getIndexOfChildComponent(this))

If so, it would be nice if Component had a function for doing this.

Yes, that’d work.

You’re right, it would be a good method to add - it seems odd that I’ve never needed to do it before…

I have a similar question. How can I set the z-order of a Component directly (after it was created)? I know only about toFront() toBack() and toBehind() functions, but I was curious if there is a way to set exact value of z-order?

Y.

No, I seem to remember there being a good reason for not setting the z-order directly. Can’t remember what it was though!..

I understand, anyways it can be done with toFront() and toBack() instead so it’s not such a big deal, I just wanted to know…
Thanks.
Y.