iced
iced copied to clipboard
Disabled state for widgets
I want to have some buttons and a pick list grayed out and disabled depending on some application state. Ideally, a whole Row, Column or Container could be set to this state, disabling all widgets in it. Is this possible?
Buttons can be grayed out by not assigning them an on_press
message. When creating your button you could do something like
let mut button = Button::new(/*... */) ;
if button_must_be_enabled {
button = button.on_press(message)
}
As far as I know, PickList
s cannot be disabled.
Also there is no method in a Row
that allow you to disable all its buttons at once
It seems that TextInput
also cannot be disabled, unfortunately.
Do you guys know if there is a plan to add such a feature?
Could we include other types of widgets too, especially button-like widgets like radio buttons?
I would like to pick this up. I created a first PR for the checkbox widget (https://github.com/iced-rs/iced/pull/2109) and I also have a branch ready for the picklist widget.
https://github.com/iced-rs/iced/assets/880421/a11a563d-c37f-4342-8d40-418c30f2285f