Why is the y size of the TabContainer always 14 pixels bigger than the size of its child node?

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

I need to resize the TabContainer with script, but it is always 14pixels bigger than its child node.

You’re probably going to need to add some more details here to get any assistance.

  • What child nodes have you added to the TabContainer?
  • Specifically, what 2 dimensions are you comparing when you say “14 pixels bigger”?

An image or two showing your scene tree and the resulting “problem” you’re describing would be helpful too.

jgodfrey | 2020-02-15 15:33

  1. I have added a ScrollContainer node, and I tried to add other nodes inheriting Control, but it still does.
  2. You can see the difference of the size through the “Inspector” panel. In fact, I printed the size and it showed that it did.

Images:
The first one is the TabContainer, the second one is its child node.
I set the child node size to 962, and the TabContainer automatically turned into 976.

And I found the ScrollContainer has the same problem, but it happens on the x-axis, not on the y-axis.

I think that maybe the UI-style causes this problem.

enter link description here

enter image description here

DogeMassaji | 2020-02-15 16:22

Sorry, I don’t know how to show images directly on the page

DogeMassaji | 2020-02-15 16:25

Although, the TabContainer’s size also includes the tabs themselves (above the child controls), so it would naturally be taller than the child controls, right?

jgodfrey | 2020-02-15 17:58

I don’t know. I can’t find any methods to control the size of tabs

DogeMassaji | 2020-02-15 18:17

If you select the TabContainer in the scene tree and look at the bounding box shown in the canvas area, you’ll see that it contains the tabs themselves. If you select a child of the TabContainer, you’ll see the bounding box is only that child (below the tab set).

So, I’m not sure why you’d expect both the TabContainer and it’s children to be the same height. One has tabs and the other doesn’t. Maybe I’m missing the question entirely…

jgodfrey | 2020-02-15 18:39

I just want to caculate the height of TabContainer so that the other parts can adap to the screen size. I can find other way to do it. I am terrible at UI.
Anyway, thank you for your answer.

DogeMassaji | 2020-02-15 18:56

Oh, I forgot to tell you that I made the tabs invisible all the time. So I think, although the tabs are invisible, but godot still adds the height of the tabs to the height of the TabContainer.

DogeMassaji | 2020-02-15 19:29