Bug in Styling.class

Hi @pspeed,

while becoming familiar with my project again I discovered something I would say: Is a Bug.
Setting Style attributes during creation of lemur elements only apply to the defaultstandard style.

Some minor changes in Styling are necessary to make it work. I tried and checked it in TextField, Listbox and an individual (my own) created lemur element.

And as you may ask (bonus etc…) I already made a PR and yes again I have documented and explained it there.

Hope its realy a bug and if yes the fix fixes it.

Thanks for the patch. I need to think about this but I guess the reason I never hit this issue is because I always set a default style. (No… that’s not it because it seems to always use the root style.)

It’s weird because it’s either a HUGE oversight or today’s eyes are misinterpreting what should be happening.

Reading the code again I think the name of the method is a clue: initializeDefaultStyles()

And the annotation also:

Emphasis added. It’s not meant to set “defaults for the current style” it’s meant to set “default styles for this component”.

I think you are looking at it from the perspective of “Your style” when it’s really from the perspective of the GUI element. Like, if you create some new FooWidget and want to make sure that some minimum styling is always available then you set those values into the root style (which all styles inherit). So no matter what weird styling the caller is using, there will always be a fallback.

1 Like