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

Where the custom-drawn control's properties should be stored? #174

Open
tmssngr opened this issue Mar 17, 2025 · 0 comments
Open

Where the custom-drawn control's properties should be stored? #174

tmssngr opened this issue Mar 17, 2025 · 0 comments

Comments

@tmssngr
Copy link

tmssngr commented Mar 17, 2025

Let's take, for example, the background color of a Label. Each Control has a setter and getter for the background color property, but it behaves inconsistent. If one sets a null value, the getter will not return null, but the default color. However, setting a color means to use that, while setting null means to "use the default". In other words, this official API is unsufficient for a Renderer to know whether to fill a background or not.

I think, the current situation in Button or Label, where some properties are stored in the control and others in the renderer, is not ideal. I'd prefer to have all properties in one class.

We can solve that by having an internal state object, e.g. CustomLabel (a subclass of CustomControl) where getBackground will return null if null has been set. The Renderer then will access all properties from CustomLabel, not the Label directly.

What do you think?

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

No branches or pull requests

1 participant