Hi,
I'm trying to find a control or a way to have a container open or collapse if you press on the title bar like this: https://en.wikipedia.org/wiki/Accordion_(GUI)
The Godot inspector tab in the editor uses this a lot, but I can not figure out how to do it in my game other then custom build. Is there some control or something I overlooked?
I tried a custom solution with a VBoxContainer containing a button and another container.
VBoxContainer
Button
VBoxContainer
Label
Label
Label
Button2
VBoxContainer2
Label
Label
Label
I added an AnimationPlayer to animate the rectscale.y of the inner container.
func _on_Button_pressed():
if(container.rect_scale.y == 1):
player.play_backwards("Accordion")
else:
player.play("Accordion")
It has a nice animation but the ui elements following the shrinked container did not relocate leaving a blank space between the button and the next ui elements. Only if I hide the inside container, the ui updates its positions, but then I can not animate the accordion.
func _on_Button_pressed():
if(container.visible):
container.hide()
else:
container.show()