Skip to content

DynamicDrawableDefaults.md

Noah Gibbs edited this page Dec 19, 2023 · 1 revision

Dynamic Default Values for Drawables

At first I thought default values (things set with style(WhateverWidget, fill: blue) etc) could change constantly -- on every draw in Shoes3. but no. Then I thought they were only set on object creation. Closer, but still wrong!

You can see some interesting stuff with defaults going on in the code to examples/legacy/not_checked/expert/video-player.rb. Of course, it doesn't still load, even in old Shoes. It hardcodes a path to a VLC library that isn't around any more.

(GitHub issue that shows the interesting code)

So it looks like in Shoes3 the Link and LinkHover default styles would get updated whenever you changed the text on the widget. Notice the comment about how that won't change until mousehover unless you change it. Though that doesn't match some of the behaviour I saw in Shoes3 -- it didn't seem to change on every hover.

But do we want it to? Not sure.

That's part of the problem here. What do we want it to do? This is pretty deep into stuff that doesn't really have to work like Shoes3. When do we want a drawable to pick up changes to default values? Do we want that at all, or should it be a creation-time thing and require setting explicitly?