Skip to content

DynamicDefaultsPerDrawablePerSlot.md

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

It looks like, from no-longer-functional code (that code: examples/legacy/not_checked/expert/video-player.rb) that Shoes3 would let you style like this:

def set_controls(color=gray)
    @bckgrd.fill = color
    @controls.style(Shoes::LinkHover, stroke: black, underline: "none")
    @controls.style(Shoes::Link, stroke: lawngreen, underline: "none")
    @ctrls.text = CtrlsText # won't refresh until mouse hovering, otherwise
    @vol_knob.tint = lawngreen
end

What's interesting there is that @controls is a Flow there, which contains @ctrls, which is a Para. So well after both have been created, the app is setting the style on Link and LinkHover dynamically, at runtime, expecting to refresh immediately-ish.

So for a specific slot it's setting the default value at runtime and expecting the drawables inside that slot to pick up the changes. Though not until you change the text on the para. Still.

Is this something we want? This seems pretty deep into the obscure. But also if you don't register a hover even on the para, I'm not sure how else you change its LinkHover styles dynamically. Otherwise you'd have to, like, create new text items for your para or just replace the whole para.

(Old GitHub issue with more specifics)