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

MenuButton ignores custom styles because it's flat by default #30768

Open
Shadowblitz16 opened this issue Jul 23, 2019 · 8 comments
Open

MenuButton ignores custom styles because it's flat by default #30768

Shadowblitz16 opened this issue Jul 23, 2019 · 8 comments

Comments

@Shadowblitz16
Copy link

the menubutton's normal style don't seem to be rendering even though it's set to a the same texturestyle as the button below it
image

@Jiaming00

This comment has been minimized.

@Gramps
Copy link

Gramps commented Feb 24, 2020

This still doesn't work. Am messing with it right now and none of the theme stuff functions.

@dominiks
Copy link
Contributor

dominiks commented Jun 9, 2020

By default the MenuButton is set to be flat. In this state it ignores the backgrounds of its styleboxes. If you set flat to false it shows the styles as expected.

I think the MenuButton should not be flat by default as it leads to confusion. Or rename it to FlatMenuButton.

@Calinou
Copy link
Member

Calinou commented Jun 9, 2020

If MenuButton wasn't flat by default, then we'd have to override the style in the editor. It can certainly be done, but it will break the appearance in existing projects.

@dominiks
Copy link
Contributor

dominiks commented Jun 9, 2020

I see. It should be handled similar to the FlatButton then, with the editor using a FlatMenuButton. Until then the documentation should mention that this button is flat by default, contrary to its name.

@Calinou
Copy link
Member

Calinou commented Jun 9, 2020

@dominiks We don't need to add a FlatMenuButton node for this. We just need to modify the editor theme so the normal style is invisible in MenuButton.

Speaking of which, we should also remove ToolButton in the long run as it's identical to a Button set to to be flat. (We'll have to add some code to import existing projects without breaking.)
Edit: Done in #39690.

Also, the flat override is already documented in the MenuButton class reference: https://docs.godotengine.org/en/latest/classes/class_menubutton.html
See the O: true part in the list of properties. The O stands for "override"; this means it overrides the base class' default value.

@dominiks
Copy link
Contributor

dominiks commented Jun 9, 2020

Oh right it's the ToolButton I meant and mistakenly called FlatButton. I agree with the idea that the ToolButton should be replaced in favor of setting the appearance via the editor theme.

Yes, you can find the information that the button is flat by default in the documentation but the behaviour of the MenuButton is very unexpected in comparison to the other buttons and the override mention might to be not enough - as this issue shows.

@YuriSizov YuriSizov changed the title menubutton theme does not work MenuButton ignores custom styles because it's flat by default Aug 2, 2021
@TheSecondReal0
Copy link
Contributor

I've tentatively opened PR #72418 to fix it, not sure if it's too late in the beta process for a change like this to make it in.

I'm not sure how to keep the current behavior of MenuButtons in the editor, editing the theme alone doesn't look like it'll work that well. Maybe the best way is by manually setting the correct MenuButtons to flat when they're instanced? If anyone can offer advice it'd be much appreciated!

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

No branches or pull requests

8 participants