Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4 rc3: TabBar child node set anchor not working in the editor. #73785

Closed
dqdthanhthanh opened this issue Feb 22, 2023 · 10 comments · Fixed by #87194
Closed

Godot 4 rc3: TabBar child node set anchor not working in the editor. #73785

dqdthanhthanh opened this issue Feb 22, 2023 · 10 comments · Fixed by #87194

Comments

@dqdthanhthanh
Copy link

dqdthanhthanh commented Feb 22, 2023

Godot version

v4.0.rc3.official (7e79aea)

System information

Mac Air M1 2020

Issue description

TabBar childs anchor not working in editor.
Ảnh màn hình 2023-02-23 lúc 04 28 01

Steps to reproduce

Create a TabContainer node with some Tabbar node inside it. Then create some UI node inside Tabbar node. Set any anchor to child node, nothing happen. The child still in Vector2.ZERO.
Note: only child on first Tabbar node works.

Minimal reproduction project

Uploading GodotProject.zip…

@YuriSizov
Copy link
Contributor

TabContainer already contains a TabBar. What are you trying to do?

@dqdthanhthanh
Copy link
Author

dqdthanhthanh commented Feb 24, 2023

TabContainer already contains a TabBar. What are you trying to do?

i mean when i create content inside tabbar, i can't set anchor to it. For example when I create a button, i can't set it center or full rect to it. Everything is still normal when on godot 3.5.

Ghi.Man.hinh.2023-02-24.luc.09.40.39.video-converter.com.mp4

@YuriSizov
Copy link
Contributor

YuriSizov commented Feb 24, 2023

My question is why are you adding extra tabbars to the TabContainer, when TabContainer already has a tabbar, and you don't need to add one yourself. Tabs will be created automatically once you add any control node child to the TabContainer. So what are you trying to achieve by adding extra tabbar nodes?

@dqdthanhthanh
Copy link
Author

For multiple tabs, of course. Even so, still have a bit of a problem with setting anchor to it. Especially in ui interface design.

@YuriSizov
Copy link
Contributor

YuriSizov commented Feb 24, 2023

@dqdthanhthanh You don't need to add TabBar to TabContainer. Tabs are created from child control nodes, like PanelContainer, or MarginContainer, or one of the box containers. TabContainer already has a tabbar, it's built-in.

Same is true for 3.x, where I assume you use the Tabs nodes as children of TabContainer. This is incorrect and not needed. We specifically renamed the Tabs node to TabBar to indicate that it's a representation of the tabbar itself, not a special "tab" node (as there is no such thing in Godot). Any child control of TabContainer becomes a tab in it. The tabbar is built-in.

@dqdthanhthanh
Copy link
Author

dqdthanhthanh commented Feb 24, 2023

Thanks. But I mean set anchor for node sometimes doesn't work. For example button node (video from 15 seconds)

Ghi.Man.hinh.2023-02-24.luc.21.46.49.video-converter.com.mp4

@YuriSizov
Copy link
Contributor

Plain Control nodes don't have any size, and don't grow in size to fit their children. So your second and third tabs have no side. Anchoring works correctly, as far as I can see, because controls have no size and are displayed from top-left. You want to use containers there not plain controls and anchors.

@dqdthanhthanh
Copy link
Author

dqdthanhthanh commented Feb 24, 2023

That's what I mean, in the first node the size is equal to the screen ratio and easyly set anchor. The remaining nodes are size = (0,0) and cannot be edit. So I don't know if it's a bug or not. Or am I doing it wrong way?
123
Capture

@YuriSizov
Copy link
Contributor

Yes, you aren't using containers where you should. And you also need to set min size, not just size, as containers will override the size (and position) as that is their function.

@cenullum
Copy link

same issue and explains better: #74653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants