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

Allow specifying icons for tabs in TabContainer #592

Open
git2013vb opened this issue Mar 17, 2020 · 11 comments · May be fixed by godotengine/godot#58749
Open

Allow specifying icons for tabs in TabContainer #592

git2013vb opened this issue Mar 17, 2020 · 11 comments · May be fixed by godotengine/godot#58749

Comments

@git2013vb
Copy link

Describe the project you are working on:
gui interface for client server game
Describe the problem or limitation you are having in your project:
Currently we have the possibility to set a text to identify a tab in TabContainer
Describe the feature / enhancement and how it helps to overcome the problem or limitation:

  1. I wold like to have a image and/or a text instead just a text in tabs.

image

  1. The option to show them in sx/dx/bottom side not just in top side only as is now.
    Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
    I guess it is a editor job?
    If this enhancement will not be used often, can it be worked around with a few lines of script?:
    I'm not sure about it.
    Is there a reason why this should be core and not an add-on in the asset library?:
    It will be nice if will be a standard feature.
@groud
Copy link
Member

groud commented Mar 17, 2020

I wold like to have a image and/or a text instead just a text in tabs.

This is possible via script, using the set_tab_icon() function.

@KoBeWi
Copy link
Member

KoBeWi commented Mar 17, 2020

Well, TabContainer could allow to dynamically customize tabs, like GraphNode does it with sockets.

@git2013vb
Copy link
Author

git2013vb commented Mar 17, 2020

I wold like to have a image and/or a text instead just a text in tabs.

This is possible via script, using the set_tab_icon() function.

I checked but I don't see any Icon or similar field from inspector:
image
Is there something in documentation that can help me? Or is an undocumented feature?

edit: I use this structure:
image
So the label "Peers" come out from the "ScrollContainer" name that don't have either any "icon" or similar field in inspector..

Also for the point nr. 2?

@KoBeWi
Copy link
Member

KoBeWi commented Mar 17, 2020

It's not in the inspector, you can do it in code: https://docs.godotengine.org/en/latest/classes/class_tabcontainer.html#class-tabcontainer-method-set-tab-icon
I just said it could be in the inspector to improve usability, so the proposal is ok.

As for point 2 (you could edit the post to make it more visible btw), there's a PR that implements bottom tabs: godotengine/godot#31909

@git2013vb
Copy link
Author

git2013vb commented Mar 17, 2020

Thank you :)

@chucklepie
Copy link

chucklepie commented Mar 28, 2021

I don't know how far along this request is, but one good reason for having this as a 'custom constant' (or similar) is more than likely the texture will be a different size to the text. The net result is when you run the game your offsets for gui controls are probably shifted down and it looks a mess. But you cannot see what it looks like in design mode, so adjusting is difficult.

To be honest there are a load of properties that should be part of the editor, for example set_tab_title seems pretty basic requirement.

Maybe the problem is how TabContainer and Tabs are coupled and share common properties for some reason...

@lucasshuan
Copy link

lucasshuan commented Nov 23, 2021

@chucklepie I may be wrong, but I don't think the TabContainer and Tabs are supposed to be used together?

By all means, I also think it would be good if Godot's tabs had a text/icon property built-in. It's currently really strange how the text of the tab is the node's name.

@YuriSizov
Copy link
Contributor

Indeed, TabContainer and Tabs are not to be used together, they are replacements for each other. But they do share a lot of APIs and that's a huge bother to keep in sync. So our current plan is to make TabContainer use Tabs internally for the actual tabbar, and only add the "convert children to tabs" logic on top of it.

This proposal will be solved in master, by the way, as we now have a way to edit arrays of data nicely in the Inspector, and some controls have already been ported to that system (like ItemList). See godotengine/godot#52463. There is already a PR for the TabBar control (renamed from Tabs to give a better idea what that control does): godotengine/godot#54560.

@chucklepie
Copy link

chucklepie commented Jan 10, 2022

Ok, this doesn't really make sense to me, but if it's being fixed then fine, maybe the problem is almost complete lack of documentation (i.e. in the non-reference section, and very terse to the point of not being there in the reference section).

But when you see the word 'TabContainer' you presume it means container for tabs, which is how I coded it as 'Tabs' didn't give me obvious means of creating multiple tabs and even says it doesn't control children which makes you wonder why it's called 'tabs' in the first place ;-)

@KoBeWi
Copy link
Member

KoBeWi commented Jan 10, 2022

Tabs were renamed to TabBar, so there is no more confusion. And the aforementioned PR was merged.

But the proposal isn't resolved yet. TabContainer can't use property array, because the list of properties depend on its children. As I said, this is closer to GraphNode's slots. Although we could maybe adapt the property array to support constant property lists.

@Calinou Calinou changed the title TabContainer enhanced Allow specifying icons for tabs in TabBar (formerly TabContainer) May 15, 2022
@false-fox
Copy link

false-fox commented Apr 16, 2024

plus support, having it editable in the inspector makes it more accessible and better UX overall

@KoBeWi KoBeWi changed the title Allow specifying icons for tabs in TabBar (formerly TabContainer) Allow specifying icons for tabs in TabContainer Apr 16, 2024
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.

7 participants