0 votes

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
http://prnt.sc/ek9b08

Image:Panel deleted on button clicked
http://prnt.sc/ek9bu9

in Engine by (46 points)
edited by

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.

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.

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

1 Answer

0 votes
Best answer

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.

by (5,200 points)
selected by

thanx avencherus, i will try this now...

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.

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.

ok i got the solution,did it with _process function

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.