iced icon indicating copy to clipboard operation
iced copied to clipboard

Disabled state for widgets

Open sourcebox opened this issue 2 years ago • 4 comments

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?

sourcebox avatar Sep 29 '21 19:09 sourcebox

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, PickLists cannot be disabled.

Also there is no method in a Row that allow you to disable all its buttons at once

thenlevy avatar Sep 29 '21 21:09 thenlevy

It seems that TextInput also cannot be disabled, unfortunately.

Do you guys know if there is a plan to add such a feature?

zedrian avatar Oct 15 '21 16:10 zedrian

Could we include other types of widgets too, especially button-like widgets like radio buttons?

theRookieCoder avatar Feb 03 '23 13:02 theRookieCoder

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

avsaase avatar Oct 03 '23 21:10 avsaase