Change Look And Feel Dynamically
-
@bendurso can you make a snippet? Iām currently sitting on some LAF things and changing class selectors is supposed to work (unlike changing LAF dynamically).
-
@Christoph-Hart Yes sure, something like this
HiseSnippet 1135.3oc6VstaiSDEdbabEM.KrR7.LJ7mTTakcurzlJzl1zFHPuD1TVsRHzpwiGmLpimwxdx1FVsh8IhmMdCJmw1I1tIzKHw+vQJIybt8cNymOmoerhxRRTwHq5WNIhgr9L6ASj5QcFQ3RTuiQVOy9LRhlEiy15nIQjjDlOxxZ4u2rg0p0PoO+0KOhHHRJqXKD50JNkcJOjqK1se6ehKDcI9rK4gkzdm18nJYGkPMFvyx1NnHB8JxP14DiZKYi9ARxHj02X64ukiu6Kn645t0t6tmi2daS22a6.x16vHd66rmKY+cCb1AYsxI9bsJdflnYIfSOR4OYvH00xr.7ZdB2SvLKbQCfHmsMpyHtvu+zhSBBYUqeQoZ4rR0WYeF2mOa+hR1WlJ.WXQ4hl0R2GjbeBPxpDjpkAomaOfFyizERL34Ss6IgSv.Bb1TFJY5hVJnlcGEngTuYH4JV2XXwLKZ9BGm0wvWqcP85v4ShF+NRL9LBMVcJI.+c3o1RiYPJcphRDmpTWcnzuKiIZB1chbHWx1LgoS8MS5mZdRyeswocunw5XyOtM9MSHl5Xi18jBvtA5IB1fQLltYi5X3YSAe3HMVOB+9z0lm.vuaDPB4hIsvGFyIh0wuhMbrfDevLknP4LtE1S.7pCpZZB+2YsvteazM2Qv0LSvZg20woPhlcidCB.CYKLkYJUExhH99b4PvYNQ2f2srC8Tw9r3M7TZsJDT.jmnDbe7Wu0glOYZ9gzuyxTeR7UUSzGcxVJgudDWyNXdWrnj99S7GJ4efBviuHjUHZTkz0UnHZv0WxEL2RLugLcGUXjRBKZ1nhVodnxNFh0bjzorNi17TVGNXrjp4JIVIOZLfUoqIbwJQS5zXsNfJwX1Z0ee8UmKFEz1NB3UtlopheItQF8sAtE7Wy4qAhe.h6hyl7X2XMiOyQPGhP3Ab3l2EZF3WB2mqzrKjMSwWcfVcWQAAKTVtyDr3EJ1z0N99LrobbnGKtb0wnHzkpZquUdbs9nY0kRJpj8jb8EQr70cUBeSKMy+muQIJuvZZYliPPUcZCymk2vLqLh3fSV0NulhRge4oYneo2wDMYpi.eBwIhEq4lzw5X16focYchW09XVxUZUDL3Z1oIzJVmO5HKrkIMoA+KrqviP2LK7e7maOo7hb.LcTTkFq8IRl.4Mb5rzUWYZB.8ABK181au8iU2cqxaadQedkul6qgov1V+oEBMJsIgY0OZkVomko0dDE3hrqMqT109OZile1FLUU4Cs3zUG0ZtDRt.fDVY9lYFlLgqmT9RJOg4uN2672GKDetcetlNZwXboEfQfd8eAFyu0xmaeRP.ipK.XM6tu4e6UTdfv+J0XCW9LhNlCG11mONb.PmnLH5RfilXXNKYHNYqcLqMUfA.UNcAv5tMWnqYsUtP2oBQgFF+aoYuXatWzmjtCfIY58FssgKWL+6xgvUzdKkV0MyLZEiQtOUqfqn9+V7OZg4RwGNFF5m8V.BcV+SRamZYchj.DpTxG5uAT1EgiAI would like to add class selectors to all elements, including th, tr, td, button, and others.
-
@bendurso yes you're right, if I add a button, it works:
HiseSnippet 1210.3oc6V0saaaCElxwJn1aqaAXO.Dd23NjDXY6j13fg5Dm3Mike7pSKJvvPAsDkEQnHEjnahaQw5ixdF1ivdR1ivteWjcnjrkTsSWBv5cSAHl776GOmCO7LLTZSihjgHipWLKfhL9byQyDJuddDl.M3HjwCMOkDong3DRGNKfDEQcPFFq88ZBFUJih+9qmdHgSD1zLRHzKjLa5ILelJi5vt+Hiy6SbnWv7yIc6tCrkhdRtbJfm0LafBH1WRlPOinEqjI5GHQdHiu0bmlsra67XmlM2YucsI6R2yk35Z0xoc6cexdVs1iz9I6RarCxX8icXJY3HEQQiPFkOT5Lajm7JQhCdAKhMlS0arPi.OmPtuj6nOhZpnddLtyv4ApHDXkgYgs0RBaes4oLG1B5YguuJlANSi7APiREg2ZEfmUd30HG7VAjLxAoxIPZCyQ1gr.UFGMd9LyABHa5Rf7TdnjHKpTPY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L5zxMa7gAPekscQyrPo00JYce0BFF++03V0POx+ASgY8RtEfPmN73398FFGKHPAUbwG5e.MToxACI'll take a look, but it shouldn't be a problem to recursively set the classes with the method.
-
@Christoph-Hart Am I reading this right Christoph - changing LAF dynamically isn't supported or supposed to work??
-
@Orvillain Depends on what you mean exactly. You can't swap out look and feel objects at run time, but you can change the appearance of components using either code branches or css classes if you're using css.
-
@David-Healey said in Change Look And Feel Dynamically:
@Orvillain Depends on what you mean exactly. You can't swap out look and feel objects at run time, but you can change the appearance of components using either code branches or css classes if you're using css.
hmmmmm... interesting......
I've got a bunch of effect slots where the user can choose an effect. There are 16 sliders that get bound to the effect controls when an effect is selected... but also.... eventually each effect is going to need its own look; I sort of took it for granted that I could change the assigned LAF to the various components for the effect at runtime.
Does this mean I need one big fat look and feel object, with effect-name aware branching??
-
@Orvillain said in Change Look And Feel Dynamically:
Does this mean I need one big fat look and feel object, with effect-name aware branching??
Yes but I'd break it out into small individual functions, so the laf function holds the branches and picks the appropriate draw function based on the effect.
-
@David-Healey Gotcha. Thanks man! Looks like there's a chunky refactor in my future!

-
@Orvillain definitely do-able, I do it here - where each effect slot has a fixed max number of knobs, and depending on which effect is loaded in a slot it selects the correct background, colours and knob styling (as well as visibility and placement obviously):

-- theres even a control on the Ui to set overall brightness of the colour palette...
-
@Lindon Nice! And you're doing all that with branching logic in the LAF's ??
I did make a start, and I got a mix control to turn into a slider versus a knob, depending on what effect I have loaded. Seems pretty flexible for sure!