MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.43k stars 313 forks source link

[Feature request] Ability to disable widgets #2803

Open pbouffard opened 1 year ago

pbouffard commented 1 year ago

There are lots of situations where one would like to control whether certain widget is enabled (able to respond to interactions) based on other factors, often the state of other widgets on some sort of configuration panel. Consistent with most other GUI frameworks, disabled widgets would have some kind of visual difference, typically "grayed out" or similar.

This should be relatively straightforward and if I get a chance I'll implement it but any thoughts from the maintainers would be most welcome!

What would make sense to me is to simply have an observable, default true, that controls if the widget is enabled, and when its value changes it would adjust the appearance of the widget elements appropriately, and cause any clicks to be ignored. I think I can see how to do this by adding a new attribute to all the widgets and having their onmouse handlers check it .. I guess there's not a good way to do this in one place generic to all the widgets with Makie's architecture but I might be wrong.

jkrumbiegel commented 1 year ago

There's not a good way to do it centrally, no. But in principle that's exactly what I would do. enabled = true/false sounds like a good name? And the style for disabled would have to be worked in everywhere where there are color settings.