if - else in for loop help
-
Looks like if I change my function to this it works
inline function onButton1Control(component, value) { Knob1.showControl(true); for (i =0; i < ButtonArray.length; i++) { if (ButtonArray[i].getValue() == 1) { Knob1.showControl(false); } } };
but still not sure why the original wouldn't work
-
@dustbro said in if - else in for loop help:
If any of the 2 buttons is pushed, I'd like to hide the knob.
that's not clear to me... Do you mean the knob should be hidden as long as a button is still ON?
What if the two are ON?
What if clicked OFF? -
This is how I would do it. Note that the buttons have
saveInPreset
set to false.HiseSnippet 866.3ocsV09SZCDF+JR2FcCyLYeeM9IHnFvotkvVFxaKDmJYnlkXLli1C3hs20b8paDi+us+j1+AaOWagVb.S9f8KjmW98b+tm2N5J3VDeet.ok6rwdDj1qz6MlIG0XDlxPcZhzVW+XrujHLiTUerG12mXizzV6KJEZ4xhB+98mqicvLKRhJD5BN0h7UpKUlnsasinNNsw1jynto7duZcr3rFbGd.vm0zKi7vV2fGRNAqbKiNR6YsroRtnmDKI9Hsr041i6Mh+CVj+WP8o8cHJgJndPfhT2l6XqXrRKpwHpic2I2aeDDktIYg0hxBuQ+XpMcp9jrwqCMXlfHc9PKyxnWkzzq7imdZonW1H5sgdOKA0SlXQwsWp2gAEpAXnDjlVQ9hx71L5M3fGL4Nt3aHsEfvTDENnb4sL2ub4hUyaj2.JD9RyawByiX79UL+j4DnCIxFbWONCDJrYn0MUXRPTOPJ4rCEB7X.2kWAFMWzWdiAbgYAJ3X4plTyOZtK7SoREyabWDrTQ6R5UKjHQtsYoBzRUJVr57vtiuBASJ3NMvNN8glqBbVjOUhMTrpw8p6Ok4PYDyAALKIkyLeneErlbzaA2Ym.RBgCSI63Ck8I9VY6HWplKuw8USEyS3RxorBEMtyHmw8FlOzzfAy0VbbcHh4ZVMUIVFvBr.29DwDlOwQn8Z19W8E2+ld7xJpfjxQNqCiJO0ivVTWMJtJp5uiYE3pLr6d83t6dNTah.Qgl3mqGlUQgDN89Ez4cZhk3IgAhHbJdDgjpt.ZMI2B6ehFZxo2j3eij6AGzzFG3RN6gFUlCOzb5w0bzOmdj+57ZiSDFVyGeKoCqqf.8VpYMzJE4cSEYzEoir6Rib1+ahJIt0RGWz40P+65DXoF2NvAKmcSmZ8drAn8YlUJp0FLepbb50+OIq+drzcC8tTo0n4y2LyguPKySMeieLIudqACHVxDxlUu82e5e4.8MdfjxFdLVJnPCg9IAt8f2VsH.SXLhiZDWKiZXLRtrRVkY5QX1gB+A9hMVQIqEarxDiHWrkfesUzHr54pWDpA3DK7U6bvee.jMmN6p3sK7F50VVpDw1.ymOhcWYDuakQr2JiX+UFwAqLh2uxH9vRPn9CKGFH4tQiEfhtsB2Ypo0hggtpvNPzeAHQ3xRA
-
@d-healey with your solution, if you click ON both of the buttons, and click OFF any off them, the knob comes back
-
@ustk If either of the buttons = value, the knob is hidden. Otherwise the knob is shown.
-
@ustk said in if - else in for loop help:
if you click ON both of the buttons, and click OFF any off them, the knob comes back
That still might work. the buttons would be set to momentary.
-
I assumed you wanted a way for the knob to be shown again?
-
@dustbro David has a good question, if set to momentary, I guess a new click bring it back?
-
Not sure it is what you want but...
HiseSnippet 889.3ocsVEtaSCCD1ocFnEFhIwCfU+UpzVU5.FHMgnacqnpQGUT1DRHDxMwc0ZI1UNNCpl16FOR7F.mcRVxftosJsz+z6N+c96Ne2YOTI8YwwRExo1mmOigbdBdzbgdZ2oTt.0eOjySwCnwZlhjpZ24ynwwr.jiS02aT3TaEj862uaWZHU3yJTgPGK49rOvi35BsC6b.OLrGMf8YdToU+xN88khtxPYBvmpXOzLp+ozSXGRMKqBF47f8C3ZoZjlpYwHmU1UFLezT4ODoq+XdLebHyHzFMBbTp5dxv.CiMZQcmxCCFlG2wHvKCKxBUSyBOGOfGvuTeQ13YVCjBDkyGNUtI50tL87t8zyoD8VIkdqgG4q3yzEVLb6w39B3fZBENBJSqz0hpLnBtqDVgP2JhdJqmBDtDg6VddqSdkmWysWst4GbTDqImQUjcSzZoXGkhNm7VxWy8wILcWYzLo.Dbajtn1MZt9p0IW22MAcyFM+11WciOPHG2F1xECyZsQNc4hPtfQljH70bofHEYLx.VICc8yQtN36vDVyUqedJU4SHtopNuf6E+ytOshgiwbW0lrQlVfQtMNK8XsQSCWLHtvPnK.gIREwcLgKJmCaRF2J1DIVm0kFFNFJyc+WB2baabUJfNTpYeT31r940qU+h5j+0zjIKzVl+BYpEZ1zCptIfthjnwLUdZKegPw3Uq1wWe0d4lQ+zCyRKTJ5K35ONiIttd.TVE.zMTMiUv+z1dgml0Kjl8PbnjuFNKUhrTt77Hzc.9l2A3iB4ALkE9Cw1ZiE.9n96Q0TSKcV7.w3LlRyMoOm8XmAyJSavqg2iEepVNyFvYEtPJ9VDx+7xs7WG0YdgvIc3wCjQfenJPsSEzcxwaVxwniK63n6fiWPZpvscJ6VzQcNKu.xoJ5+mABShkAIgT8UGOatSJy.TEek4flYchXtdd46rtWlYeao6Z3gbs+zEy2JKfuPsy8MeytAbU79Slv70EjcEbuub+ecG5SxDMWbx.pVwgZC7gIQifGD3y.lHDrPyjFnFy.0J6YjMYlQLQfU3OvWlw1FYmLisyMhhn9J428S6kM2w9HqFfSB6SMpAu4AjIW1Diwds7PQvU+e222jJ1.39hwr4Rf4EKAlWtDXd0RfYqk.yqWBLu4FwXd00NIZYTZaBnX391goNN6KnPUlshD8WSza3gC
-
Think I understood... You want the knob to come back on button release, following your code...
In this case this one line does the same thing:
HiseSnippet 858.3ocsV0tSaCCE0osdasaf.o8.jwuZkXnTFvlDZZkVZmpX.Uq.ZRSSH2D2VKRrqbbXqZh2s8Hs2fsqcRaRYkNnRj9md+3bywWe70oiT3RCCERjUwyFOhhrdAt6XtZXigDFG09Pj0p3iIgJpzN1U8wiHggTOjkU9OpcXUr.x776OTm3S3tzTWHzEBlK8Sr.lJ0amZGw78aQ7nmwBxj8N0Z6J3MD9hHfO4wNnQD2qHCnmPzokCirdRSOlRH6pHJZHxpPcg23tCEemGm+ErPVOep1nJpKTnX2sD9dZFq8hZLj460Yx5NDAUoSZWHebW3k3iYdro9S6FqYBXmhHa+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