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

Add option to disable checkbox #2109

Merged
merged 8 commits into from
Feb 1, 2024
Merged

Conversation

avsaase
Copy link
Contributor

@avsaase avsaase commented Oct 2, 2023

#1066 raised the issue that most widgets cannot be disabled. Lots of UIs use this concept so I would like to add this functionality.

This PR adds the option to disable the checkbox widget. I used the API from in the button widget: the checkbox is disabled until you call on_toggle to register the function that produces a message. A on_toggle_maybe method, that takes an optional function, is provided to make it easier to change the enabled/disabled state. If this is the desired API then I'll make separate PR's for the other widgets, or I can add them to this one, whatever you prefer.

I don't have UI design experience so I'm not set on the styling and I'm happy to take suggestions for improvements.
ezgif-3-6e3418370d

@hecrj hecrj added this to the 0.12 milestone Jan 31, 2024
@hecrj hecrj added feature New feature or request widget addition labels Jan 31, 2024
@hecrj hecrj force-pushed the feat/checkbox-disabled branch from 7d9fd41 to f25b105 Compare February 1, 2024 12:09
@hecrj hecrj force-pushed the feat/checkbox-disabled branch from 76eb751 to 4afe1c7 Compare February 1, 2024 12:16
@hecrj hecrj force-pushed the feat/checkbox-disabled branch from bfb7e68 to faeb453 Compare February 1, 2024 12:22
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you! 🥳

@hecrj hecrj enabled auto-merge February 1, 2024 12:26
@hecrj hecrj merged commit 759f0e9 into iced-rs:master Feb 1, 2024
13 checks passed
@avsaase avsaase deleted the feat/checkbox-disabled branch February 1, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants