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

Disable Form labels when the element it applys to is disabled #1530

Closed
AlbinoGeek opened this issue Nov 14, 2020 · 8 comments
Closed

Disable Form labels when the element it applys to is disabled #1530

AlbinoGeek opened this issue Nov 14, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@AlbinoGeek
Copy link
Contributor

AlbinoGeek commented Nov 14, 2020

Is your feature request related to a problem? Please describe:

When creating forms (which currently, I can't use the Form type properly, covered in another issue); I would like to be able to "Disable" (grey out, just like with Entry fields) Labels corresponding to values which can no longer be modified.

Example:

image
(Notice how the Label visually seems very out of place when its corresponding Entry is disabled?)

Is it possible to construct a solution with the existing API?

Yes

Describe the solution you'd like to see:

Make Label Disablable like Check and Entry already are.
The text would go grey, just like Check and Entry already do.

@AlbinoGeek AlbinoGeek changed the title I would like to be able to "disable" a Label [FEATURE REQUEST] Disable a Label Nov 14, 2020
@andydotxyz andydotxyz added the enhancement New feature or request label Nov 15, 2020
@andydotxyz
Copy link
Member

I have a feeling that this might be more of a Form feature than a label widget feature.

@AlbinoGeek
Copy link
Contributor Author

To my understanding, the widget itself has to support that method Disable or Enable, or be Disablable in the current widget system, but I could be wrong.

e.g: the reason you can't add non-FormItem to a Form currently (whether by design or otherwise) is (to the compiler) because they are missing the Hide() method.

I had tested implementing this on my own extended widget and a Form technically lets me add arbitrary widgets this way.

@andydotxyz
Copy link
Member

FormItem is the metadata for a row in a form. It's Widget field is a fyne.CanvasObject that can be anything.
On the left hand side (the Label) our Form code could decide to use something other than Label to display the text.

@andydotxyz
Copy link
Member

The Form API is based around form features. If you want to arrange custom elements like a form then use fyne.NewContainerWithLayout(layout.NewFormLayout(), ...)

@AlbinoGeek AlbinoGeek changed the title [FEATURE REQUEST] Disable a Label Disable a Label Nov 17, 2020
@andydotxyz
Copy link
Member

In form this makes sense and can be handled automatically by the widget - updating title to reflect

@andydotxyz andydotxyz changed the title Disable a Label Disable Form labels when the element it applys to is disabled Nov 17, 2020
@AlbinoGeek
Copy link
Contributor Author

Sounds good! This does make quite a bit of sense, as Form was exactly the context of usage (at the time.)

andydotxyz added a commit to andydotxyz/fyne that referenced this issue Jul 22, 2021
In 2.1 we could return to using Label as RichText would allow colours.
But for now using Text works :).
Fixes fyne-io#1530
@andydotxyz
Copy link
Member

Feel free to give the PR a test :)

@andydotxyz andydotxyz self-assigned this Jul 23, 2021
@andydotxyz
Copy link
Member

In release/v2.0.x branch for testing before v2.0.4 release

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

No branches or pull requests

2 participants