Replicable custom UI components via namespaces
-
Here are many examples of custom UI components ,based on panel component , as expected.. I,ve include an external scritp and use te namespace in it to create many of them in a example project. This all work fine ,for the moment, but dont allow the posibility to use mouseWheel event.
Recently I,m trying to create one that can use mouseWheel event based on already create code, but for the moment I can´t find the way to replicate it in a project without problems . So I send you a Snippet of the actual project expecting someone can make any suggestion to solute this problems:
Here is the HiseSnippet where you can see the problem and, if you want , use the code for your own projects:HiseSnippet 3643.3oc2b07ababEmqsocVZqDmhbnH.EX5BTicinWuKoksSUVqOsbTi+PURItAFAATjiVwXtjaI4ZaYAAjCA8R+KH2JPOTzK8ZaO0.z+AZOUzbnHE8RCZOTf9GP5algeL7ykq7Ja0rwQVbl27du48l4Mu2OuC2v0QG6443JTq916ODKT6Bhasus+dqrmlosv5qJTSRbkQd9NCdeSgk2enlmG1PnVsSeaR+0peFAAgewm+4+0EVVyRyVGGzD8yG3Xpiui4.S+3V2Xw2yzxZMMC71lC3n9pKttti8JNVNi.c4zhcDFpo+Hs936oQH6ThB0N6sLL8cb2xWyG6IT6LK6Xr+V647DaF8efom4NVXxCcE1BXDq40brLHZLoUgU1yzxXiv4rm.vkMhs.mlYAdCw6ZZXF0drk3hzNPwif2dT6TIUuSmP85xqdc3TubToSwoRmgoRut3V5tlC8i6gnOmWbcaer6tZfYmWUXzJbpu75hq3.TX62df1ivq4BODMhlJc5HifezZdI3yi0bQ9fGwsGBcK69l1315tXXpPbSt2emOAq62r07HD5JWAsDiTjuCRS2ejlk4yvHv8465Xgz7QFXOy91ThjpiXD21yWy0mxslyQkZbOXV6qnYYsC30at6HaceSG6lsHDcfT85nccbaZhLsQgyn9X+krrVwYvPGa3YulM1PyFa8VMZ05.yca98MITrtQyVsIJF3BAJdOamcf9QlscwCgl7Wev.rgILKs1GlbGRj1gslG9IptzUtxacL74XhsnLejrgMNdvlHvyP2+duQfI1T+8GtJrlT5.JMR0AiimOBOXn+92QaWTuH6Ky6eGGcMq6337nkrMVCisZR7agTCVw9ldv5o0B8W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8XUUOR3tvrNiHS9lIL4WpD+jRBmwqM1cuE3L9TsEqvxSdy54N249USxFiztnjN1+6G14aR4Lh3z.5Mw+r+yug8YfFYNb1uaPuIbUyHtsqls2PGOraJ+zqG20RCfCa8S5tN+XCcU88Npks2gTt.ISpkcdJ4xrOH50L.74FeA+hQVa+mEXS3PRVTH68m+BbSa5UmOocf+xymwHDGJdBth+cK8J9miFdQw65XLxRyO4Kb.RfrfNfzBRnnjaxusmo+97lho1agfpphut3Fl956kuNdpbzQxK3fiAcL3c2vLh2Z2cgDHiUvyHt1O4EvKpgf2dFuZPnPVjv.mXpni7JylNNC3VNCY470Krp1fgjiCYMsnp5+Xg3Hnz19JRJIq5tOeaB+ke4WsvC3BQQ40ZtX7yvf2gSB+9Epc5o0BYF.d8uqFTfNY+OjD9VPDKcL3.rgc5jLSqcJxAhrm6PdlnsagsMnOPhXEzY2v3FjN6F1IuW9UhdGkPMo2NzIGZ1QjV5Vz6oju5m8u9yKrJ1RKwxwGj7L1ObwbdSlrtM3572vwRyM8h4okoLwahjx2wQlRnSzQE9NhTy7Ickj55OYqjWjbh4KIU7Ewl6WDxXfltqyGG7FBfrU6Uns.yaa5KWn5h2k7LJptOQwNs6.oUYX9w55jiPtLTWb9iQ4HLF0ivXt5QXLycDFy0NBi45GgwbiRGC48rzRifR6Xq4gF13VzpfqU6VrunFjk+B+OzKKOpA
-
@jadg Are you asking for how to have knob reacting to mouse scroll and also be able to inc/dec the value using click, you can do something like this
It will react to mouse click to increase and decrease (arrows), holding an arrow down for 500ms will start a timer to inc/dec automatically.
On the left side of the arrows you'll have the mouse scroll function.I made this as a "Knob factory" under a namespace and you will return the knob component.
To create a knob you just execute the function like this:
const Knb = CreateComps.createKnob("Name of the knob", x, y, w, h);
The colouring is taken from the component colours, so you have to adjust them to your liking.
Maybe you can have some use of the code (that is if it will solve your problem)
Cheers /ulrik
EDITED
I tried the code to make several knobs and found some bugs, so here is the new code, I hope it will work betterHiseSnippet 2604.3oc0ZszbabbD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dQMwOvtEKMn2rswqLCaDhouMrwrW18MsWuSGZPZgAdM6M9Cucdy1VpW1Y2s7SikQ8sGMnMj.GPgYmCq6viRV5J3g9TO6oyJaS4gxGvr+rAafOWJavF5AgrNnu3uHPcrK70o+SjT.ahK+eRPY6svmI4Gzy11qtGl6w9hf.z8mGNG5rko4kPlEuDxrzkPl6bIj4iuDx7quDx7aNSYv+SUrxnTw.0xAfPq0kG7sTo049PlkLKz5+PQuVmP
-
Thanks Ulrik . A few hours before I can see your reply I´ve found for myself a solution for the problem in my custom NumericUpDown control. Anyway some of the ideas you apply in your code was been usefull to complete my code. I´ve resolved the problem by other way, in a manner easier for me. My code is now perfectly working and improved with your ideas. Thanks you very much.
This is the full code for the CustomNumericUpDown namespace:
namespace customNumericUpDown { const emptyLaf = Content.createLocalLookAndFeel(); emptyLaf.registerFunction("drawRotarySlider", function(g, obj) {}); inline function createFromPanel( panel,stepSize,sufix,fontSize,fontName,showGainFactorAsDecibels,showNormalizedPercentage) { const var Action=[]; Action.push("increase"); Action.push("decrease"); reg p=Content.getComponent(panel); p.data.fontSize=fontSize; p.data.sufix=sufix; p.data.stepSize=stepSize; p.data.fontName=fontName; p.data.showGainFactorAsDecibels=showGainFactorAsDecibels; p.data.showNormalizedPercentage=showNormalizedPercentage; p.data.action=""; p.data.activeArrow=""; Content.setPropertiesFromJSON(panel, { "saveInPreset": 1, "allowCallbacks": "Clicks, Hover & Dragging", "opaque": 0, // "stepSize": stepSize, }); // *****Add child knob to panel reg pKnob = Content.addKnob(panel+"Knob", 0, 0); pKnob.setLocalLookAndFeel(emptyLaf); Content.setPropertiesFromJSON(panel+"Knob",{"parentComponent": panel}); pKnob.setRange(p.get("min"),p.get("max"),stepSize); //************************************************ //***set knob control callback******************** pKnob.setControlCallback(onKnobControl); //****************************************************** p.setPaintRoutine(function(g) { reg kn=this.getChildComponents()[0]; kn.setPosition(1, 1, this.getWidth()-26,this.getHeight()-1); // set Knob bounds at panel resizing var decimals; var textToShow; if(this.data.stepSize<1 && this.data.stepSize>0.09) decimals=1; if(this.data.stepSize<0.1 ) decimals=2; if(this.data.stepSize<0.01 ) decimals=3; if(this.data.showGainFactorAsDecibels==true) {textToShow= Engine.doubleToString(Engine.getDecibelsForGainFactor(this.getValue()),2)+ " dB";} else { if(this.data.stepSize<1) textToShow=Engine.doubleToString(this.getValue(),decimals)+" "+this.data.sufix; else textToShow= parseInt(this.getValue(),10)+" "+this.data.sufix; } if (this.data.showNormalizedPercentage==true) textToShow=parseInt(Engine.doubleToString(this.getValue()*100.0,2),10)+ " %"; var a = [2,0,this.getWidth()-19,this.getHeight()]; //area to draw text g.setFont(this.data.fontName, this.data.fontSize); g.setColour(this.get("bgColour")); g.fillRoundedRectangle(this.getLocalBounds(0.7),6); g.setColour(this.get("textColour")); g.drawRoundedRectangle(this.getLocalBounds(1.0),6, 0.45); g.drawAlignedText(textToShow , a, "centred"); if(this.data.activeArrow=="up" ){ g.setColour(Colours.withBrightness(this.get("textColour"),100)); g.drawTriangle([this.getWidth()-18,this.getHeight()/2-10,9,7], 0.0, 1.0) ; } else{ g.setColour(this.get("textColour")); g.drawTriangle([this.getWidth()-18,this.getHeight()/2-10,9,7], 0.0, 0.8) ; } if(this.data.activeArrow=="down" ){ g.setColour(Colours.withBrightness(this.get("textColour"),100)); g.drawTriangle([this.getWidth()-18,this.getHeight()/2+2,9,7], 45.0, 1.0) ; } else{ g.setColour(this.get("textColour")); g.drawTriangle([this.getWidth()-18,this.getHeight()/2+2,9,7], 45.0, 0.8) ; } }); p.setMouseCallback(function(event) { reg k=this.getChildComponents()[0]; if(event.clicked) { if(event.y>(this.getHeight()/2)-14 && event.y<this.getHeight()/2 && event.x> this.getWidth()-18 ) { this.data.action=Action[0]; //increase this.data.activeArrow="up"; k.setValue(k.getValue()+this.data.stepSize); if(k.getValue()>this.get("max")) k.setValue(this.get("max")); k.changed(); this.repaint(); this.startTimer(500); this.setTimerCallback(function() { this.startTimer(200); if((this.data.action==Action[0])) { k.setValue(k.getValue()+this.data.stepSize); if(k.getValue()>this.get("max")) k.setValue(this.get("max")); k.changed(); this.repaint(); } }); } if(event.y>(this.getHeight()/2)+2 && event.y<this.getHeight()/2+14 && event.x> this.getWidth()-18 ) { this.data.action=Action[1]; //decrease this.data.activeArrow="down" ; k.setValue(k.getValue()-this.data.stepSize); if(k.getValue()<this.get("min")) k.setValue(this.get("min")); k.changed(); this.repaint(); this.startTimer(500); this.setTimerCallback(function() { this.startTimer(200); if((this.data.action==Action[1])) { k.setValue(k.getValue()-this.data.stepSize); if(k.getValue()<this.get("min")) k.setValue(this.get("min")); k.changed(); this.repaint(); } }); } } if(event.mouseUp) { this.data.action=""; this.data.activeArrow=""; this.stopTimer(); } }); } inline function onKnobControl(component, value) { p=Content.getComponent(component.get("parentComponent")); p.setValue(value); p.changed(); p.repaint(); }; inline function setValue(p, value) { p.setValue(value); p.repaint(); } }
And the HiseSnippet if you want to test the project or make some suggestion. Thank you .
HiseSnippet 3142.3ocuZs0ababElqsYRHahiCbaQQ.ZwTBz.xH506tRNwtJqstY0rN9hpjrcKbMBnHmcEs3RxRxUVJKV.2eB8w7VA5eh1GBP9OzG5iI.4oh9ReoOmdlY3kg21KJxkPPK4Lm4Lm47cluyLjyNAdl3vPu.gFR6epOVnwaKt2otQGt4gF1tB81RnwOQbyQgQdCe3ng3.ayG6uk2KcE13TeivPrkPiFW72PDsgzkDfq+4e8auyFFNFtl3jhHWOwy1Dee6g1QYktyZelsiy1FV38sGxI8Jq0yzycSOGuQfYcQwVB9FlGYL.+PChXWPTnwabWK6Huf8hLhvgBMtzFdVmt2gD6hJ+SrCsOvASdnsvdfhXEusmiEwhIkJr4g1NV6jL7CE.srSly3hLmwOV7A1V1okm4TtBsBTVK38GMtPdy6h4Lu17lWKNyqBS5hblzkXlz6ItmYfseTVMD64GI1yMBGz2.b67lBSVgK7m9Eha5AR3F0bnwQ3sCfGRagZmVszQK2pk1pxv0wFAnH.QB5hP20cfsKtoY.FFJDXJ3QG7BrYjp1p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4bFi3xV3UDefm0HGin7msTRh23JfkVmyPIGZS2P6nS4iXN2NvoyqI9dh6XGYdX013EpvFAT90gMFGK+Nh2seerYTlAdIws+culNStM1ozYl9xw4vYoviAwBo04Mlc87FxMq+u7ke4+5NaYLzmvHwJZskW96tSVp+rUzuUvo7k8p+8u8auyS4nbo5Z6.L9Kv.5v0C+86b9M0kcvfF7.in.aBmFLmbOf41DGybP1cWiKPliydtE4YxHXOrqE8guGthqrcBWHox1IU9+k9XngYf2mGeFrHX6aQKAF2tziZtj3CHOiR2ZnnXqlsfrRV1etoIIJ6Zv1OqtMcNCsY4yPaV4LzlabFZyGcFZyGeFZyMmZaHm590GAabgw5.Eryco6wqQi65Z.Quz4WB+O.nrovcB
-
@ulrik said in Replicable custom UI components via namespaces:
x, y, w, h
Great Code like always, Any tips on how I can move the knobs Freely, so it doesn't look at This line?
Knbs.push(CreateComps.createKnob("Knb"+i, 4 + 140*i, 20, 130, 30));
Thanks Bestie
-
@Natan You can set the laf and paint routine outside the create factory