How to make the tabs of a TabContainer fill the screen?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SebSharper

Hi. I have a TabContainer with their respective containers as children:


I want the tabs of the containers to fill all the screen width, and to be the same size.

How could I make this?

not a real answer, but you could create your own version using simple buttons, and screens that hide() and show() when you click on them.
a little bit more work but much more customizable

Andrea | 2020-05-27 10:44

And how could this be done with buttons? Also, wouldn´t that be a bad practice?

SebSharper | 2020-05-27 18:59

Hi! I know this is already months ago but I’m also stuck on the same problem. Did you already found a solution on this one? Or you ended up using the idea commented by Andrea?

jjcdesamito | 2020-11-03 18:21

Ended up using Andrea’s idea. Buttons are way more customizable

SebSharper | 2020-11-03 18:34

And how could this be done with buttons? Also, wouldn´t that be a bad

Sorry, i literally missed your reply up until now!
Hope you found a solution, if it was me i would have used a TextureButton node: they have all the nice things about buttons (pressed/toggle signal, mouse enter/exited signal) plus you can use your own texture on them.

Then, you can create 3 different control node , one for Item1, one for Item2 and one for Item3, (same position, one on top of the other) and put whatever you need inside of them.
When you click on the button (or hover the mouse) the respective ControlNode get showed and the others get hidden.

To make 3 buttons with the same dimension, alligned, you can either positionate them manually (it’s not so hard since they are only 3) or make them child of the HSplitContainer node, in this way they get automatically positionated

Said that, there is probably a way to use the tab node, and include images into the label text, like How to add a picture to the text - Archive - Godot Forum
(but i havent tested it personally)

Andrea | 2020-11-03 21:34

Thanks! I also tried asking it on some people in discord. (and it looks like it is not yet customizable to the way we want). I’ll probably use Andrea’s answer for now.

Also thanks Andrea for elaborating how to do it!

jjcdesamito | 2020-11-04 09:42