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

get_stylebox("myStyle") doesn't always get the correct type. #1431

Closed
Ace-Dragon opened this issue Feb 24, 2015 · 11 comments
Closed

get_stylebox("myStyle") doesn't always get the correct type. #1431

Ace-Dragon opened this issue Feb 24, 2015 · 11 comments

Comments

@Ace-Dragon
Copy link

An example...

Say I made a progress bar, and I gave it my own style using the "newStyleBoxFlat" entry.

Now say I fetch the bar node using GDscript and used this code...

var Style = myBar.get_stylebox("myFlatStyle")
print(Style)

The print will give me "StyleBoxTextured:#" when it should be saying "StyleBoxFlat:#", as a result, I cannot change the color because the function for that is only for flat styles and the engine thinks I'm using the Textured type..

This shouldn't be too hard to fix I think, thanks.

@reduz
Copy link
Member

reduz commented May 1, 2015

not sure if i understand this bug, did you give it your own style using code?

@Ace-Dragon
Copy link
Author

The simplest possible test case
http://www.mediafire.com/download/fciqbi9dw8jn5t8/UI_Test.zip

When you play the file, it is clear the stylebox type for the bar graphic is flat, but the debug output shows that the function doesn't recognize that and instead says the stylebox type is textured.

@akien-mga akien-mga changed the title [Bug]; get_stylebox("myStyle") doesn't always get the correct type. get_stylebox("myStyle") doesn't always get the correct type. Nov 17, 2015
@akien-mga
Copy link
Member

Confirmed in the current master branch.

@akien-mga
Copy link
Member

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about it here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

@Chaosus
Copy link
Member

Chaosus commented Sep 30, 2018

ProgressBar really uses StyleBoxTextured by default, but in UI_Test.zip shows an incorrect usage

func _fixed_process(delta):
	var myBox = get_node("ProgressBar")
	var Style = myBox.get_stylebox("myFlatStyle")
	print(Style)

there is no "myFlatStyle" stylebox in ProgressBar now. The correct usage is

var Style = myBox.get_stylebox("fg")

which is correctly handled as StyleBoxFlat or whatever you apply to it. Closed.

@Icemole
Copy link

Icemole commented Aug 15, 2020

For anyone still coming here: the string passed as the first argument to get_stylebox() is NOT the resource's name, but the name when hovering the name of the node, near the checkbox (Godot 3.2.2). In my case, I had to hover over "Panel", and calling get_stylebox("panel") yields the correct StyleBox. I hope this helps someone out there.

@tx350z
Copy link

tx350z commented Sep 12, 2020

THANK YOU! You just saved me many hours of head-scratching and expletive outbursts!

@akien-mga
Copy link
Member

Sounds like a documentation improvement is in order.

@akien-mga akien-mga reopened this Sep 12, 2020
@zak-grumbles
Copy link
Contributor

Hi, I'm interested in updating the documentation here. Quick clarifying question: Has the get_stylebox() method been renamed to get_theme_stylebox()? I'm unable to find the get_stylebox() method in the current Control.xml. Admittedly, I may be looking in the wrong class.

@Calinou
Copy link
Member

Calinou commented Sep 26, 2020

@zak-grumbles Yes, all the theme item getter methods have been renamed from get_<item>() to get_theme_<item>() in the master branch.

Make sure to open the pull request against the master branch. We can cherry-pick it to the 3.2 branch ourselves once it's merged.

@YuriSizov
Copy link
Contributor

YuriSizov commented Aug 2, 2021

Documentation was improved by #50429.

@akien-mga akien-mga added this to the 4.0 milestone Aug 2, 2021
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.

9 participants