• 2D
  • Tabs vs TabContainer and Signals

Hi, I tried to use (from Tab Control) tab_over signal

to emit a signal when mouse go over the tab - not container, just tab.

But it not work.

There is a solution?

Thank you

I don’t think so, the tabs in my memory are not under TabControl. Please think about this problem @Megalomaniak @Vale-git

The problem is that tabcontainer implements tabs in a outdated way that doesn't offer much control. As your own second link indicates. Both issues are related to this fact.

Yes, this problem caused TabContainer not to contain rich signals. But in this question, it was obvious that both the example and the subject(https://github.com/godotengine/godot/issues/37875) added tabs to the TabContainer. This should not be the case. The two should be the same function and the same level.

In short.Tabs should not be under TabContainer @Megalomaniak @ Vale-git

Sure, the Tabs node is for creating tab like buttons, so if you want to have sort of subtabs for an example.

Yes, but obviously this is the scene structure in the title - TabContainer -- Tabs1 -- Tabs2

Tabs don't emit a signal,because he doesn't do it Tabs1.add_tab("tab 1"),he doesn't have a tab in tabs1 so the tab_hover don't emit. This is the reason for emit a signal not working

There is already an issue opened in github

https://github.com/godotengine/godot/issues/37875

I think this reason is godot engine need optimization TabContainer,but not Vale-git’s problem, his problem is mixing TabContainer and Tabs,and not add_tab in tabs

Of course you should not add tabs under TabContainer.

Well, you should be able to add tabs under tabcontainer, though it might be a good idea to have a intermediary item, such as panel or panelcontainer between perhaps.

Well I think the idea would be to keep TabContainer, but replace its own tab "buttons" by an instance of Tabs. i think this is a good idea ,but the issues not update https://github.com/godotengine/godot/issues/4512

At least now, you should not add tabs under TabContainer,you can try it,It was a disaster,like this,I believe this is not the effect you want the code is

extends Tabs

func _ready():
	add_tab("tab 1")
	add_tab("tab 2")

when you hover mouse in tab1 it can emit signal tab_hover

So i think you should not add tabs under TabContainer.becaue the tabs's signal is the tabs's children emit you can try it

Is still not clear to me how I can accomplish to have a signal in the tab button only and at same time to have the structure like TabContainer. @vmjcv your example require to add container in code or a design time? Can I do it a design time?

Sorry, I have n’t thought of a reasonable way to achieve your purpose. Maybe you should find a way to change TabContainer so that he can hold a tabs, but this requires changing the engine code,like this https://github.com/godotengine/godot/issues/4512. At least for now, tabs and TabContainer are approximately the same node. Do n’t nest them together is the right choice.

Of course, I will continue to think about whether there is a way to solve your problem, or try to change the TabContainer and provide a PR

Easiest might be to just ignore the tab container and use tabs and panel node and such to build your own custom alternative to the tabcontainer.

Easiest might be to just ignore the tab container and use tabs and panel node and such to build your own custom alternative to the tabcontainer.

I also think this is a good idea, at least in the present situation

ok :) I will chose what @Megalomaniak said.

Thanks =)

Ok =) I will choose what @Megalomaniak said. Its the most reasonable way I think.

Thanks =)

7 days later

I start to use Tabs but I have a question: The StyleBox panel is referred to what? As far I know there is no panel in Tabs. Any hint?

you can add panel in tabs,And control it by script

@vmjcv said: you can add panel in tabs,And control it by script

I added a Panel as child node to a Tabs but when I change the "Panel" Custom Style in Tabs I don't see any changes in Panel. It wasn't supposed to work in this way?