How to duplucate LAF knob
-
Hi everyone. I've added a laf knob to the script folder. I've used ```
include("name.js"):
``in onInit and it appears and works fine. Now, after modifying it or even keeping it original, how can I duplicate it to create more knobs? If I duplicate it normally, it doesn't work properly. I also tried duplicating the js script and re-creating it, but when I include it in onInit, it doesn't appear and the other one gets corrupted.
Thanks for your help. -
Create a new local laf object for each knob design. They can all exist in the same js file as long as they have unique names.
-
@d-healey thank you for your reply.
I think I've misread the code. How do I create a local LAF object? I placed the script in the scripts folder and used the include"name.js" function in onInit. Is there another way (or rather, the correct way) to create a LAF object? Thanks. -
You don't need to put this in a separate file, and at this stage it might just be making things more complicated for you.
Here's an example of creating two laf objects.
const myLaf = Content.createLocalLookAndFeel(); const myOtherLaf = Content.createLocalLookAndFeel();
-
@d-healey thank you!
-
@AGD_ are you trying to have different designs for each knob or do you want them all to be the same?
-
@Chazrox thanks for your reply. At the moment I want to create 4 knobs with the same layout. If you've any suggestion, thanks.
-
@AGD_ yes.
You can highlight all the knobs you want to share the LAF. Right click and create a script reference to them as a group.
then do:
const var allMyButtons = [ Content.getComponent(button1), Content.getComponent(button2), Content.getComponent(button3), Content.getComponent(button4) ]; for (a in allMyButtons) a.setLocalLookAndFeel(myLafFunction);
thats off the top of my head. I think that looks right.
-
@Chazrox thank you and sorry for this late reply, but I wasn't in the studio yesterday. Thanks, I'm just starting out, so I might be asking some silly questions.
-
@AGD_ All good. lmk
-
@d-healey it's works fine! Thank you David! I'm looking forward to your next course because now that I've finished the first one, I'm having a bit of trouble following the correct order to continue, even though I'm studying your videos, which are fantastic! Thank you so much.
-
@AGD_ Thanks, are you on the Discord server? New course will be ready pretty soon
-
@d-healey yes I'm on Discord serve, thanks