Repaint panel or sliders on combobox callback
-
@gorangrooves As David says, it doesn't work here either
I tried another way and that worked.HiseSnippet 1035.3ocsV01iZbCD1KGaTf9hRj5OfU2m1TQP.WRZkppJANnB0iKzv0nVEEEY7ZXcwq8JaStCUEo7an+R6+f1w6Kr6cfHbHU9.f8LOy7LiGOimnjDpVKUHmZWsNlhb9R2oqElv9gXl.M5bjyW6NFqMTkW5V8VGi0ZZ.xw4je1tgSspnjO+yO0CywBBsXKD5MRFgdAKhYJ1cR2egw4CwAzqXQkz9YcGQjh9RtbEvmSbaghwjk3EzKwV0p3hbdvf.lQplZvFpFzomLX8zP40hT8eCSylwo1EsQSACktMpeHiGLIOV0HjS0IEQ9IoQ923NlEv1reQF3QIB7JPTNG3TYeTp88fRNknT0TJ8X2oDEK1THwxmuvcj.NPligTcYpjpKpxeW0suDzPXZFgWRGpfEaP3+hVsZ3Ae8jendcHcqMde.CGti648id4vVPM8kQwRArv+TP1oVsyTmimWRUhhBA9ERBlegTt7khfgTJ2uv5f5CWIHsALygeMLoveQCO4r+7I0+q50VzTacl8L2O8GcyEJ5Zv.fr4PgxqkqDAzfWSIFrXAm5CPahA21vqsMJpsaibcHyPSsRfBe8.NmEqKCtCH7i2klctGzL.qVdvTsygS08EvEz9179r6AuIgXkQQWooGFyOXhekhcWviwlvlSF8ssZ97RTGpnrVaqpFHX1pvQCQ1ayKhZr4bZy+N6c.BlfyDzMY.OEcAy1z5B7beFDX2jjL.DMykLLOYcpk4P09LYO4Mmtwr52lf6c1nKktBH6DC8DLigqhPWIaM9GgfYKmC8vF2yd+PI49j76QMf6Y7UzDhTldI69z1Yol8bCLM+mX09XNeFzazurq.KThBWJMzWI7SbGPSu6JZ97cJKyVbpZmhsMrU6CnuXUzLppbvZUD5nc61jO3vZSRRSGkTTJFIXlWESyVOTxCrs+r+e6lpnr7os8ZFCAUMIMWeTVy07ydDCLiqKjPQIju7jMzuM5brAmaFvhfWhoJCyFLNmS+.LlKsmcM2yo5kFYbhtYGgHmG9Yc5MENj0ccwh+n60r.S3lM9DtaHksHrXh5m90tQX.tqyIVvFZj15InRtcc3qN1uNCl6t07EXxlLXEGat83N6b8LAvg6slwXmiHzLy5xYm6wLvV6cF3gRwG6NgYHg6liU1AGgCt+O3X1KG9J2AymCcNKHXU2g+9w9LgOi6gN0FlXAzXUwrm4WtJZJzLlPAuKDTt1VGTwV5mttkcsMCLE5fkr3egOYBaaW6jIrctPTDlnjumjdgw91jGlrCvIQxSwpAuIDV60N+lhqaqlsPQvyjdOgXC+mB2F2MlNGAlyNBLO6Hv77i.yKNBLe2Qf462KF6KTe4JiLJ85.rwjAIcrbbFHvPkURUH5+v3kgFg
-
@d-healey Thank you. I thought it might be something like that. I was able to draw a single slider the way you suggested, however, I got tied up trying to implement it for the array.
Here is my original LAF script:
const var PannerLAF = Content.createLocalLookAndFeel(); PannerLAF.registerFunction("drawLinearSlider", function(g, obj) { var a = obj.area; var thick = 2; //thickness of the line g.setColour(PanState == 1 ? 0xFF666666 : 0xFFe38727); g.fillRoundedRectangle([a[0], a[3] / 2 -thick /2, a[2], thick], thick / 2); var wthick = 6; // width of the handle's white outline var hthick = wthick - 2; // width of the handle's innder portion var hx = a[2] * obj.valueNormalized - (hthick) * obj.valueNormalized-1; // x location of the handle var cx = a[2] * obj.valueNormalized - a[3] * obj.valueNormalized; g.setColour(Colours.white); //Outer white ring of the handle if (PanState ==3) g.fillEllipse([cx-1, a[1]-1, a[3]+2, a[3]+2]); else g.fillRoundedRectangle([hx, a[1], wthick, a[3]], wthick /2); g.setColour(PanState == 1 ? 0xFF666666 : 0xFFe38727); if (PanState == 1 || PanState ==2) g.fillRoundedRectangle([hx+1, a[1], hthick, a[3]], hthick /2); else if (PanState == 3) { g.fillEllipse([cx, a[1], a[3], a[3]]); g.setColour(Colours.white); g.setFont(FONT_REGULAR, 10); g.drawAlignedText("M", [cx, a[1], a[3], a[3]], "centred"); } }); for (s in AllPanners) { s.setLocalLookAndFeel(PannerLAF); }
It works perfectly for a single component.
How do I apply this to AllPanners array, using PanStates[] values of PanModeComboboxes array?
-
@gorangrooves If possible I wouldn't hard code the colours in the laf function but apply them to the sliders and use these within the laf.
-
Thank you. That works for a single element.
As you can see from my script above, I was able to place all 3 looks within a single LAF function. It works perfectly if you want to set the same look for all of your sliders with a single change of the combobox.The challenge here is applying LAF looks to individual sliders based on the value of their comboboxes.
@d-healey Hard cording or using slider colors doesn't really make any difference here. Its like telling the guys on a sinking ship: "I think you better put on some sunscreen."
-
@gorangrooves said in Repaint panel or sliders on combobox callback:
As you can see from my script above, I was able to place all 3 looks within a single LAF function.
Update the snippet with this change and I'll take a look
-
@d-healey Thank you, Dave!
I appreciate you wanting to throw me a life line and not just a bottle of sunscreen
HiseSnippet 1913.3oc4Y07aajaEeF6LAQZ2rMKvdo2H7kJ0Ha8oSVTWiH+k1ZTYaAqrKJfgaJ8LTZXMEovLTqkS2.rG5eDcu0+K589OQA5oTTfdtW5412iyLRyDI4Mqj2KMCL7HR993268HejONcBTtrvPUfkctWd6Plk8G6z8Vo1+.eJWZc7gV1ehyIzPMKfD0092NjFFx7rrsW+KvNry8.Kyy+9E6SEToKaZWVVekh6xZyGv0S6sSyeMWHZQ8XujOHE0MZdrqRdfRnFA3YcmJVCotWS6yNkhjslik8COxiqUAc0TMKzx9A6q7tsqu5FYD8eEOjekfgMpZ0EDTT2sTBODwXuVG3yEdcRr6PKPJcl5EVOxK7YNmv83S5ep23IlAHS4Hs+vdsrva8LvqZZ3UIE7lCjrSAoGDAoO0oqa.end5HHd9HmikPvoGEb6ogRDsVq8W9HmCT.ER8VCnWyZE.MlvQgmUoRIB7uh6jGnJTIXa4JXzfBPG4gXQnl70z.xgCB6PkveLAYWRh75yzGnFLTIgFE1HEMafbmh88DBneIKHD39h4ydDd6J3drfpaTrTdxBd99Yu1pwd8Ui8FqF6auQwKy36AO2IJOFP9UpqTiY2gOzPy9pw2o+6NQRhDpsxRn9JKgFqrDh8k4iciQqJQ22k6Ttb0MIsKedIRsMOub6Rj5aR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oHTIOVx0mMjIWTAPVwaD.0cjOFU.oZSUGehS5SmZwghK9IY5ppkA3wUw8m+tu6e7BqevBoVFg71W+Y+qkPH0yHju8u9ed6RHjFYDRy7+s+4RHjsy5SFt6eeVg7jXNRNrpQLXwZwmgOiHLUW+CUD0VcQTe0EQiUWDaOGQ7kGeHUSwJkim7BSnGxfMCw0J1Gx9ZtKKpt4bNGxBuVqFZY+vIEI.+NR0ONopZrvUiderSpRYsFm9xLtMcCy9xS5nyeroOi22O00b7aaZ6jRge768Bp2WcZc5L5rQyP8sBy037qTA7WC9FJXVZ1fjqUI2Cezi9S8PZYRJj.AuNi1vg3j3sFDBoMvLwXL.ZB4m6eHOfYRY8NxDJEBLqT1WV+l0RX40RY4u8207CHKudZKe3GRVdiTVdma+Pxx2NcL+a++AK+Qum6rsf7aMYMGPgwbrWGZg1BjJ+m5DcX0p4idWK9c8Y8QZvf.tcNX+pKArVXxm6OXUaIf0ByLb+Aq5KArV3x16OX0XIf0BWSc+AqsACdl6l+INmf2+GUm8SEf2LX7.3Bqz2OOdG7xPt91zmp4d66G79BwO0oCW65OeLt1bvHbfqeLvX7Wc4wNG0qGjEZJ.efSqeyONehEKnVZMW1+DpNfiyLNczftPlSWFncnBQAVyk8ZX0QQsqfsQOPWlzyz3+BOwCVEaaGOX0jAsFPcCTuJ91iwuqyiL8.XRZ9jV4bNAaSlbZeGmJaUwZ.jq9Uttn4uIjKa97TaI3o9RvSikfmsWBdd1RvyyWBd976jGbax8FoUChVN.cz4HSkF11GY1G0LKz5+g3ZY.N
In this script, changing the first combobox, changes the look of all sliders. (The other comboboxes are just standing there looking at what the first one is doing.)
-
@gorangrooves it works in your example as well, you have to have as many created laf objects as panners, and store the 3 functions as separated functions, then it's possible.
May a bit too much workEDIT simplified snippet
HiseSnippet 1996.3oc6Y8zbZjbEeFIMtDrqS7VUNjbqKtXHFg3exdqxI0Bh+XSEDPA3s1TJJNsloA5ngtolowBbpTUNjOD49dOmxGf7EHmy0MmRka62fjW2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+Er7Cui+x1ZxuUhTZLFVyPeeXjzVfT4+HCUAPnbw8dl2+Yga6iDfAAbaT4zbaArVaxmGNXkeKf0ZyL7vAqBaArV6w1GNXUbKf0ZOS8vAqS.C9VuxvmXbl7VhXQz2fo79i9KHOXE90FJe0fLWpXd3Bidvdsl2UH9YFcnByQqFi6sBLBEb8g.i9uL3GaTav.HKzR.dfQ8u5Cya9UqKepfxFdFV3PkQFslNtGj4zjHee7PpM4ctz2Sd6HuwYkikdfdDlkZv+D93uXN4Xc+EyErn1XroC+s98XP95lOTMCfIl5MsGy3L4Xzhp8MLxlIq1XHW8aMMkl+QPtrUyS9sfmBaAOE2BdNYK344aAOuXK34y2HOxelr7TAer2wAXhN0T2zPWul52QUQgZ+K.bfrkzA
-
@ulrik Yeah, I know I can set each slider separately, but I am looking for a more elegant, scalable option. I know that Dave is a "freak" of that department
-
@gorangrooves said in Repaint panel or sliders on combobox callback:
I know that Dave is a "freak" of that department
Working on it... :)
-
-
@ulrik I appreciate your help very much, regardless of what solution yield most practical results! Thank you.
-
This is the problem
var PanState = PanStates[obj];
obj
is not an index, so you will always getPanStates[0]
.I can see a couple of possible solutions, but the thing that is really confusing me is why the laf function is retriggered when changing the combobox value... I added a button to the UI and pressing that also triggers the slider LAF function. Maybe it's always been this way but it seems weird to me.
Edit: Nope, I just made a test and this is definitely weird behaviour in your snippet. I need to figure out what's going on.
-
@d-healey I am itching. I've been pouring over this for over a day now....
-
@gorangrooves There is something very strange with your snippet and I can't figure it out. I'll make a new snippet.
-
Ok here's a minimal example. I'm just colouring the sliders in a solid colour, you can fill in the blanks in the laf to do what you want.
There are a few ways to achieve the goal but I just discovered that we can now access the component ID in the
obj
within the laf function, I don't know when this was added so if it's not working for you you need to update HISE. But using it I think gives the cleanest approach.HiseSnippet 1187.3ocsW01aZbDDdOaeIkqsQIp4yUm7mNjbH.NMspVsEaroEE+BJjZUojznk6VfsrrKZ2EanU9OT+00+Asyr2AbIFgsox9CV2ryaOyK6rCszpXlwn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VZFbSBegfjCCO3FvP0TL722FLrJ+bSw5to9olmyO9deM3k6g37Fa1ljeQjbQ7uWaH0gvMABtkMzfHuRP0fcI2c+TMmepwt+7yt4iG6s1OWeEDX4GUxXA09waDgq9kw.KG4WCAW0PZ31o4uybGVSp7JWS51Bwm32BWAX4XbikfQ3578AFyVt7K8OpaWn2cA.2xuwustaRdCt+0pwVtr2ITqlik5SGOrMrfQLC7tTxDFr7uANbNktLRiYf1vqZNh+E9KiYEj1KiYkYLICowZ0GhSGlhqu9YtS.LIcaqW.9YC.c37o399kKUlLD1j9CwwX3+L38hkqS00PmcWCcdwZny2rF57x0PmucMz46VoN3OhY+wV0vzqCvAsNx8Nlm2QRJzY45BI+GngGjOC
-
@d-healey thank you very much! I'll investigate that thoroughly and report back (on successful results, i hope).
-
@d-healey @ulrik Thank you both so very much! Both of your solutions work very well.
@ulrik I didn't see your latest simplified version at first. While I was taking a break, I was thinking of a possible solution if I wouldn't be able to iterate through the index within LAF. I thought about creating multiple LAFs within a loop. Then, when I opened your latest script, I saw that you did that
Thank you!
-
@gorangrooves my pleasure