Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

You could mildly simplify your "on change" logic by using widget.toggle:

on change label active do
 if label = "Words"
  field1.toggle["solid" active]
 elseif label = "Picture"
  canvas1.toggle["solid" active]
 end
end

If you're frequently changing the set of widgets affected, it might also be worth considering a data-driven approach: form a dictionary mapping labels to lists of widgets, and then toggle entire lists:

on change label active do
 wids.Words:   field1,field2
 wids.Picture: canvas1,canvas2
 wids[label]..toggle["solid" active]
end

And in principle, with a somewhat different contract, you could even lift the toggling up to the tabstrip itself, just leaving the user code to construct such a dictionary. This would, of course, be somewhat less flexible.

(+1)

You could mildly simplify your “on change” logic by using widget.toggle…

Wow, how did I miss that? I should have more faith that Decker provides the kinds of features I’m looking for.

If you’re frequently changing the set of widgets affected, it might also be worth considering a data-driven approach…

Oooh, I shall do exactly that!

And in principle, with a somewhat different contract, you could even lift the toggling up to the tabstrip itself…

That did occur to me, but it wasn’t clear to me that a script could reach outside the contraption to toggle the visibility of other widgets on the card. If I have to write an event handler on the target card anyway, it’s already pretty easy, and you’ve just made it easier! And, as you note, this way it can be useful for things other than just toggling widgets, like an alternative to radio-button groups.