gyscos / cursive

A Text User Interface library for the Rust programming language
MIT License
4.26k stars 243 forks source link

[FEATURE] Add the capacity to disable or enabled the Views. Buttons, Edit and others. Even Full Layouts. #777

Open sirlordt opened 6 months ago

sirlordt commented 6 months ago

Is your feature request related to a problem? Please describe. Add the capacity to enable or disable a Views. For example the ButtonView and EditView. And can be changed and runtime disable(&self)

Describe the solution you'd like When is disabled the input Focus is avoided, and is possible and change the color similar to MenuTree leaf. When is enabled the Work normally

Additional context Is very useful can change from disabled to enabled to get feedback from users.

Thanks!.

gyscos commented 4 months ago

Hi, and thanks for the report!

At the moment, individual views such as Button or EditView already support enabling/disabling them dynamically.

To enable/disable an entire sub-tree, you should be able to use EnableableView: if you wrap an entire layout in this, you should be able to enable/disable all views from the layout at the same time.

Does this solve your use-case?