Draw Control on top of sibling

Godot Version

4.3

Question

Let’s say I have the following Node tree.

A
| \
| A1
|
B
| \

Is there a way to draw the Control A1 on top of B without changing the order?

1 Like

you can set the z-index in the node’s properties

1 Like

Thanks

Wait… I’ve already tried playing around with that stuff and now I remember why the z-index was not a perfect solution.

I’m trying to implement a dropdown using an ItemList. The z-index will draw it (A1) on top, but the node behind it (B) will still get the focus.

I saw another project use ItemLists to implement a dropdown. Maybe that’s the wrong approach?

A lot of the times a drop down is implemented as a control, the button, and when pressed, the item list is shown as a popup parented to a root container, this way, every time you popup the list, it will always be at the highest z index in the root. Which is always above your popup button control because it’s a child of root.

2 Likes

Thanks!!

I’ve tried it in a small example and I think this is exactly what I want. Now that I think about it. Implementing a dropdown as a popup makes so much so sense. I could’ve figured that out. :sweat_smile:

Sorry… maybe it’s not what I want after all? I should’ve explained what I want to do in more detail from the very beginning.

The reason I want to implement my own dropdown is, because I want the dropdown to be connected to a LineEdit and the contents of the DropDown should be filtered based on what the user inputs into the LineEdit.

If I use a popup, the LineEdit will lose focus, which means I can’t type.