How to replace top canvas layer's panel with that at bottom layer?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sanjib
:warning: Old Version Published before Godot 3 was released.

I have multiple canvas layer with each holding panel and button. I want to replace the selected canvas layers panel with those at bottom when the button of a panel is clicked. I can only delete the panel on button click, but the panels at bottom doesn’t move to top.

Image:Panels with buttons

Image:Panel deleted on button clicked

It’s not too clear what you mean, and your images aren’t showing.

You can use set_layer(index) to affect the display order of your CanvasLayers.

avencherus | 2017-03-15 16:31

I already set layer index,

  1. I want to delete a panel when the button on that panel is clicked, i did that you can see on 2nd image( top panel is deleted)

  2. Now i want to move the 2nd panel to top along with all other panels.

sanjib | 2017-03-16 02:20

i edited the image links, can you please check it now.

sanjib | 2017-03-16 08:18

:bust_in_silhouette: Reply From: avencherus

One way of doing this is just by adding your panels to something like a VBoxContainer. Once the panel is freed, you should get this shifting behavior automatically. Otherwise you’ll want to program your own algorithm for shifting the position of your controls.

thanx avencherus, i will try this now…

sanjib | 2017-03-16 14:27

thank you it worked as you said, but deleting panel is very fast and panel moved up instantly, can we move it a bit slow and gradually.

sanjib | 2017-03-16 16:16

You’re welcome.

That’s just the built in behavior of the controls. I’m not familiar with any options exposed in the editor that allow overrides on the default GUI animations.

When building your own GUI you have to do the elbow work of calculating positions and window ratios yourself. So if you want tweening/easing of the movement of visual elements or GUI nodes, you’re probably going to have to roll your own.

avencherus | 2017-03-16 16:45

ok i got the solution,did it with _process function

sanjib | 2017-03-16 17:09