0 votes

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

in Engine by (42 points)

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.

  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.

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

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

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?

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

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...

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.

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.

Please log in or register to answer this question.

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.