Trying to make a factory method but getting an error
-
@d-healey said in Trying to make a factory method but getting an error:
@VirtualVirgin Actually in your situation you should get rid of the second broadcaster and attach the refresh listener to the first broadcaster - you don't need a separate broadcaster for each listener.
Thanks! That got it working.
-
@d-healey I am stuck again, of course.
The broadcaster for the panel text and repaint is inside a of a factory method.
It works fine for creating only one widget.
If I create multiples, it will only keep the last broadcaster made:Each broadcaster gets a unique ID derived from the factory input name, so I'm not sure why it is getting overwritten:
// Broadcaster for sending the knob value to the text property local bc = Engine.createBroadcaster({ "id": name + "bcValueSender",
-
@VirtualVirgin Got a snippet?
-
@d-healey said in Trying to make a factory method but getting an error:
@VirtualVirgin Got a snippet?
// Factory bipolar knob inline function createBipolarKnob(name, x, y, min, max) { // check if component already exists local c = Content.getComponent(name + "BipolarKnob"); if (!isDefined(c)) { // Create a panel, knob, text label and value label local panel = Content.addPanel(name + "Panel", x, y); local knob = Content.addKnob(name + "BipolarKnob", x, y); local text = Content.addLabel(name + "TextLabel", x, y); // set panel as parent knob.set("parentComponent", panel.getId()); text.set("parentComponent", panel.getId()); //value.set("parentComponent", panel.getId()); panel.setPosition(x, y, 100, 100); // set knob value to panel text panel.set("text", knob.getValue()); // draw value text on panel panel.setPaintRoutine(function(g) { var pa = this.getLocalBounds(0); g.setFont("oxygen", pa[2] / 10); g.setColour(Colours.white); g.drawAlignedText(Math.round(this.get("text")), [pa[0], pa[1] - pa[2] / 5, pa[2], pa[3]], "centredBottom"); }); // create broadcasters for knob // Broadcaster for sending the knob value to the text property local bc = Engine.createBroadcaster({ "id": name + "bcValueSender", "args": ["component", "value"], "tags": [] }); // attach to event Type bc.attachToComponentValue(knob, ""); // attach panel to trigger text value update bc.addComponentPropertyListener(panel, ["text"], "value to text", function(index, component, value){ return value; }); // attach panel to trigger repaint on value change bc.addComponentRefreshListener(panel, "repaint", "\"update the panel\""); // knob settings knob.set("itemColour", 0xFFFFFFFF); knob.set("min", min); knob.set("max", max); knob.set("stepSize", 1.0); knob.set("middlePosition", 0.0); // set text local s = name; local splitName = s.splitCamelCase(); text.set("text", splitName[0] + " " + splitName[1]); text.set("fontName", "Avenir"); // LAF for bipolar knob knob.setLocalLookAndFeel(LAF.bipolarKnob); // get area of panel local a = panel.getLocalBounds(0); // positioning and font knob.setPosition( a[0] + a[2] * 3/10, a[1] + a[3] * 3/10, a[2] * 4/10, a[3] * 4/10); text.setPosition( a[0], a[1] + a[3] * 0.5/10, a[2], a[3] * 3/10); text.set("fontSize", a[3] * 1.9/10 ); // return the local object. This will transfer the "ownership" to the left side of the equation return panel; return knob; return text; } else { // reference panel, knob, text label and value label local panel = Content.getComponent(name + "Panel"); local knob = Content.getComponent(name + "BipolarKnob"); local text = Content.getComponent(name + "TextLabel"); //local value = Content.getComponent(name + "ValueLabel"); // LAF for bipolar knob knob.setLocalLookAndFeel(LAF.bipolarKnob); // get area of panel local a = panel.getLocalBounds(0); // set knob value to panel text panel.set("text", knob.getValue()); // draw value text on panel panel.setPaintRoutine(function(g) { var pa = this.getLocalBounds(0); g.setFont("oxygen", pa[2] / 10); g.setColour(Colours.white); g.drawAlignedText(Math.round(this.get("text")), [pa[0], pa[1] - pa[2] / 5, pa[2], pa[3]], "centredBottom"); }); // Broadcaster for sending the knob value to the text property local bc = Engine.createBroadcaster({ "id": name + "bcValueSender", "args": ["component", "value"], "tags": [] }); // attach to event Type bc.attachToComponentValue(knob, ""); // attach panel to trigger text value update bc.addComponentPropertyListener(panel, ["text"], "value to text", function(index, component, value){ return value; }); // attach panel to trigger repaint on value change bc.addComponentRefreshListener(panel, "repaint", "\"update the panel\""); // positioning and font knob.setPosition( a[0] + a[2] * 3/10, a[1] + a[3] * 3/10, a[2] * 4/10, a[3] * 4/10); text.setPosition( a[0], a[1] + a[3] * 0.5/10, a[2], a[3] * 3/10); text.set("fontSize", a[3] * 1.9/10 ); // return the local object. This will transfer the "ownership" to the left side of the equation return panel; return knob; return text; } }; createBipolarKnob("TestKnob0", 0, 100, -127, 127); createBipolarKnob("TestKnob1", 0, 200, -127, 127);
-
@VirtualVirgin I meant a HISE snippet, Export >> Export as HISE Snippet, but this will do.
You're still trying to return 3 different values. That won't work, you can only return one thing from a function and the function will exit as soon as it hits that return line. You can just the return at the end of the function outside the if statement, no need to put it in both clauses since all roads lead to the end of the function.
It looks like you have mostly the same code in both clauses of your if statement. If both paths lead to the same outcome then you don't need to include it in the if statement, put it after. There is a coding principle called Don't Repeat Yourself (DRY) that you should follow.
I've cleaned up your code here (I had to comment out the look and feel assignment because I don't have that laf function, so you'll want to uncomment that). I've fixed the broadcaster issue.
That issue was caused because the broadcaster was assigned to a local variable, and I'm not exactly sure what the mechanism is that causes it to be a problem - perhaps @Christoph-Hart can explain. But I think it's basically because the scope of the local variable is limited to the inline function, so when you assign a different broadcaster to the same variable it replaces the old one - again I'm not sure exactly why we get this behaviour.
The solution is to store the broadcaster in the panel's data object, since each panel is a unique entity.
HiseSnippet 1909.3oc2Xs0ababElT1zM6ll.mhf9XwT9D2Dk0KkjkrpQQ00sUHRNKx5XT.GgfYIGtbf3NCAmYk0VCgh9OqO19uo+CZOmY3sckprk.RenqAr3Ly4x2bNemYNjiJjQLkRV33180KxYNt+RuwKD5zCSobgyIG4394dmQUZVAwN0AKxoJEK1w08Q+QbB2NO1w76e8GNflQEQrlobbdijGwNkOiqalczdeKOKaHMl8Z9rVRu0dmDIEGJyjyA77HuAN4znKnSYuhhhslmyehpRcb+JuAOeaFamMShioatY71au8tuX2s1MjlLXK5jvs2cqM1ZmMdwNINtO43XtVVLVS0LEXzCjwKFmJemv5f2vU7IYLbPnyXvy1ocNLkmEOpJ3nbbbe7nlP0irgpuz6LdLud9lP1SMKPZzncPycs6BRg2CH41BRO1BouvabTAOW2rBhmO06DAjASnPtoMTrx5r1+ri2gRPBgt+L5ErgEvfZMB1dvf0Iv+06kc69rmQFRi.zufLgmKynEjKDxIc4hLtfQRlKhzbofDUvfc2AVQ9VPh.AjCWmb05jEqSlwEv+QupW222oaGvlQornKH7DRjbVtT..gPy.SDufvthqzpt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PfI2aV+GqhfkHrrqfqgJha13AbanRiOM.OWo7hmuIbicfG2XGvN2gJgVU1XUUp6yQJdkTy9NQ.zJC.nq6RVcojjacM7t6BYVFrkuskwFiKtKECDymMgUTmvJEDZDb4tKexGW2kQ1VIZInTbhfq+tbV43gxrXrqQ74a1KpSYuHPWoqUhPPTsomzOurmzwYbnPygCF4W6UmTZE2cL6kl2GX6+ty8xVg2gsB1y4GN4Hf.h8MWB1x5FNFmbOhcI7lJ1tn63cDScgVla1MkLUG2egECeVUO1Hqy.gm1rcrSdkiqmK51E3CwvCuiGqSqFjx3SS0Uivhx1a5k74SuuwPiq+MUtFePoWfI7m3YVe4qZa+pZUWP29M5lYdAum72921evk53v+ZkFySR3WYdyrDd1LEbNP9IyfWXyw8W48CJF1cLcdllnt.rC7FBW.s3HMxuRqi2RLroEDzkn2cZGGCVJNhibZYstKmpLMCahZeYiap6RdkzkG7vGFd1r1mZllXhrUsI339Id11D9uk0wrR0khMQ6M2y49Q1BuMx1+39P1B16dS1B++KxV3+aHagOPxV3Oijsa90Cdp2Yx34YT8xeLC7y7Tt.lEa+EDvuRf.xtKZmGuGegiA24W33iEheg2HtNJ81w3Z2BFwqo9Y.ikeWnOy63jDVjtAfO1a3e9g9Qf9.t29NrSgWZr.qN7d07YiAZbDC7t.3NJjCrFRXsiGTQ+v9dMCP1d4hg3X2xECqVzYFMpP9SQ16hwu7zmXlAvjvPA63cFNlDt5stN3I.7eJJZYScCE23gp3lOTE25gp3yenJt8CUwcdnJ9hOrh32ob+4Z4LaYiiyYiN1zkjq6wBJv.MrUm+CTBkXn.
-
@d-healey Thanks David :)
Yes, I expected that there was some redundancy in the if/else that I had to weed out and thought I would see it later on after some experience (how to rewrite).
So what you provided here does fix the broadcasters to work properly, but I just want to add a note that you broke some other functionality with your revision.
You seem to have to taken away the code to detect if the component was existing or not ( I think unintentionally altered),
which made the code only proceed through the create block every time at compilation which resets the size and position of the panels.
The original functionality was to be able to move and resize the panels freely after created.Here is a snippet with a rev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ykO614l94D39JKUEErP7aZ3k1pf.W5LJHWtFpsA8nLK5Jyhk6QyHGhegI9ggL0YXvjRhr60VB24hEcPx2FuH8WhFjczwSoHpwOkBrvVAsasMpn94CI0xKI3uh.4Q.ptjc34+0Js2hN7Ogtra7why.LUw485ArZs7ZwbU+VMHY9nT2yTGjnL.DY4h+HuD4KLJzgS86nZQ2kjBlxyvaXrawA7z8sRg6lhwfBmmcu8i00dgw5ZaFqSnshZNTE2Q6FaWbtPm5uIAGw4c1PRlK0S6PF+ZcCbT6qi7pEENtyISEuwPHj4ZyEuztEtzXVqScPFa8lDpz7sRMcLPAE1SIqnzHDhkIDor5E.eBv3Xd.q4nHeLFw47nS8C6qOlexB2EsN0sbUhp0UZAxzbLGulypim.6UPSxbWc.7+QrDhRn1EDk4rjQkzPT0sh58ntm1W7i7ad+BASeWAstnkSm65rSiz2vXJvCOUeZ84LEx8pgElu9azmKU.0sLAxBxOGEysqajq7ohK6MQeauA+xZlxeZk95hQUUe1fzQtjQ.pv2qklgRE62+GIspVY43jsNOSVWh0WEE4AqOecm50Ml72hVVS+ljsGK9sNtjlbwuizFouN7B90jp98v4wG2MfcL+nDXsX+LEGCj.Z5z4NMEq83Qh0MEJRcC.frwTKgjo+DOm2YkI9gn2keAKMOnnk83WrbKt0TeMe2HTpcWbwIt1jD+WGCccoti4dYEx+tSmYYqZ5DF3hmqhinaZoUYXE66pZVwaRC5PZzoXHZ72lepOG2p5qzaMsv6lyBuhBNEeCE1t3Knv1qzET.+Ar+Zk9LC3wimjC5.Ouz.GIsuC1T.rA2VCOg71.xLmay0cJFxbGEjYw0dsRXJ0oR7ZqrqkdH6hC7CX3uGh+Ofe3Bl3
-
Ah yeah I missed that bit.
-
@d-healey
So now this one has me baffled:
I am just making a simple factory method for buttons and I cannot get the LAF to work inside the function.
I triple checked spelling and everything.HiseSnippet 3092.3oc6as0baiaElxIZ6J0KSyL6S8Ir9IJuxRTR1wwMsMqsSbZlDm0Sr2LcFOtYfHgjvZJBURn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TJvBGEztMZpR6j79ldMI+MDnuEfdrdzw9R06TYxrEcy+T5xdQmptGfIJtnWOfUajWKlq5CpPpOJw8L0MRTm.hrb4efL6366zhxBcLRwR9tjTvV9d7k.zs3DdwysRo6lhwfBmmce9y00dg45ZmMWmRaU8bXZti1Mxt3Zgsp8ojbD22YSIkMTOYBc9qMyfiZeaTWsnzwcNep7MYDBcs1b4KscvPiYsN0.Yz4SIUY1mJ0z4.UTXOkrhRiRHVlTj5tW.7Y92F70w27YdP+3ayOYgmhNtzsNJwL5JEfLMGywq4Dc7J3rBwjL2nCf+OmIIFgZOPTlSHiongpqaC06ScuneHBblxEN6yJv4JmVcdTqcqm7DFS.d3c0mVaNag9rZXi4a9I84ZEv3Ql.UAEWhh4N0xTq7HtmGbZviEQbzFB9kMxJ+Ic5G2Lpo6y5jN5PFEnBetVwLTqX+s+AwoZkkiS1w0YRmREeUTlGr+7MaUqVlM+ynkMqeSy1S0+Ulrbl7KG.g60Sdb3Ulsl6yBfCBxZ3IF20mcp3DIDK1OUwwDIflNcsyrh09hPUbSghTWe.HmYq0Px53iwZQOMO0e1QcEWwRpCpFYewUKWvcL02xuaDF0tKFbhwljn+yXXpq0cL2WVg7O6zYBaMamx.W7dUbF8rVZSEV04tpl17l1fNjFdAlhF+SwJwmiGU8CwGMsv2MmE9JJzp32PgcJ9ETXmU5ETnxGMXmh.OdBYNnCb8RCbzzdGro.XCdrFgj74.xLm2lqGVLj4gFHyh68ZkvTl6JwGsReszCXWcH2mg+8P7+kfB98O
The .setLocalLookAndFeel(LAF.button); works outside of the function, but not in.
-
@VirtualVirgin I think it has to do with your namespace "LAF" and the name of your included script named "LAF"
I changed the the name of the included script to "Laf" and now it seems to work.
I noticed the problem when I got the undefined error at line 30 on the onInit callback, that is this line:button.setLocalLookAndFeel(LAF.button);
If you encounter issues, always look in the Console, very often you can find what the problem is
HiseSnippet 3205.3oc6as0TajbEdD1ZyJkKU1T6SIuzgmFgEBMRfAG1Da.abbsFuTFVWIkKh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cbUkrJW9xzd0YxthIMmR3UqLoDuoSehsIyEZPoLZsVqlwciovOBLyo8twZNMmg8KWP5YY7hk3ZFFwZnYLAE5VacxpwCqdZef4p00k5b4qtctkeFAtuxnpnfEnyRk2ZaBBboqnZ3ZenVYFOhYUWoZrbWlMxAxVfXBALy8vfoQht6UlCy4ECc.4aBriKaGjdqimXiXl+DafKrUX2sxZpvNIuc3WRvey.z2BPOVW5Heo5MfNo2ht4ep8xNQGqtGfIabQ2tfnVI+tXlaeXKjZiRLOSbiD0AfHyW7GHxN99NcQQgNDGwb9tjTvR9d7ED0s3.dw8sPg6lPvvFNu3t8i005Bi00JarN0tUUygo3NZmH6hyE5T65DbDW2oCIk0UOoCc7qUyviZcSjWsnvwsOYh3MY.gNWat3k1MQWio0N0.L175DpL6SkZxXfpQXOAVQzn.w7DhTW8BvOy+c2XY7aV.OnW7s4mbgmhNN0s1Kwz5B4fLoDyIqY3c7R3rBwCYldGf7eNSRLfZG.JyvkwjzPU0sYz6RcOsWHRblvDN8yJn44McZukyipm7DFSHd3c0mVaFKg9rZXg4qds9bo.LtkwPVPwYHL2rVlbkGv87fSCdnHhi5PvtrRV7mToebwnlpOqSZqcYTjJ74ZEKP8F6q9KjlUqLeRxNNOSZWJ+qhh7f0mupSsZYV7aQMaV6lVrGq+NgMep7y5Ct60Sdb3UlNm6yBfCBxZ3IF0wmcr3HI3K1KciiARfc5j4NyBqcEgJ+lBgTGefHmYo0Tx53iw5hdZdpujfcDmyRxCpZYWw4ymyc7nuge2HLa6NnyI5aRh9mifttTywLeYEx+rSmxs0rbJEbwqUwQzypoMYXUm6pZZwaZE5.Z3oXHZ7KNYhMGOp5GhOZZguaNW3qnfSwugBaV7KnvlKzKnPkOZ3NEQd7DxbTG354l3nG6czlBnM3wZDRxsAkYFuMWOrXJyCMTlKt1qEhSYtqDezJ80ROfc99beF98g3+Ctq0bZB
-
@ulrik said in Trying to make a factory method but getting an error:
@VirtualVirgin I think it has to do with your namespace "LAF" and the name of your included script named "LAF"
I changed the the name of the included script to "Laf" and now it seems to work.
I noticed the problem when I got the undefined error at line 30 on the onInit callback, that is this line:button.setLocalLookAndFeel(LAF.button);
If you encounter issues, always look in the Console, very often you can find what the problem is
HiseSnippet 3205.3oc6as0TajbEdD1ZyJkKU1T6SIuzgmFgEBMRfAG1Da.abbsFuTFVWIkKhqVyzRpWFMsxLsLn0k+ajeS4mSdNujbNc2yMoQfP.duTn0KvzWN8WeNemK8LiXmKYAdLu2EEvGNjIsrJcuCCEtrnHQnUopGOdHypzup7QiCj82qOkGX8hmZU52UdOwfgh.VfbepqTDN1Z2wCoQQLOqRkt2ywwUpx8sTe9OOdWpOMvkk1jk0aDbW1K4C3xzVO7IeM22eepG6X9fLid8m7BWQvdBewH.S2qbSqgT2So8XuhhCaoxV+UZTeqRqT1yYcmta4Re3VNq2x0s0Va15Qa5xnc6xdnyFat9VcWuK0sYKqRe1y73.tORRkrHqR2eWg23i5KNKPu.ugGw63yvKbrNBVYcy6K78vsH1p0d849dIJqHP0c+Lpt6oUceY4C3d7j1SUg+VUGjzYjUAVZo7v6d4fmSV30LC7J.Rkx.o6qgzWT9H2P9PYZOHd9kkeQfjEBpGVNnnGq0RuqLXygQDHaLfdJa+P3hjYX+vlMqSfeTa6pU4At9i7X1K+RZ2FeWzxXaqsFwPTHcnQbWRmQRoH.FqOOfQ5NJvUxEAD2PFri2EGxtpQXG.135jyqSFWq5GpVADjael6oDdWhaLGjP8g44MlvNmGIi1tZEegK0m3R9yjXP2iIS3rJgRd.Y4LKD.yJUq.R09OxidJqK.KOa2Z0HvJtSTzHXBAvjIhtDYeV5ZGQ5SeOizgwBHd5oUsB.TCDz6yL3f54kYmMIHL6TDJ3+zytQDSZu7YbOYeX.agJ47c0mw60WB80R2G7O.0PWDI6bYBVh.XfK51osLzmKQuHnmnFpq1CtxeOZDydpkAEFrHIS5sMOAwO7eOHSiNmj.e.Dubm8IcEg4r5jUIm0eLwSvh.cIOBTrRxYhvSebtE7kHDeoPb5NA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NYhMGOp5GhOZZguaNW3qnfSwugBaV7KnvlKzKnPkOZ3NEQd7DxbTG354l3nG6czlBnM3wZDRxsAkYFuMWOrXJyCMTlKt1qEhSYtqDezJ80ROfc99beF98g3+Ctq0bZB
I'm sorry but that makes me more confused.
A) that doesn't work over on my end:
B) what would the capitalization of the file name have to with it?
C) the LAFs are not working inside the function, but they do on the outside (regardless of the include file name capitalization):As you can see, if I add the last line back in to the script FactoryButtonBasicButton.setLocalLookAndFeel(LAF.button);
That button will use the LAF. -
@VirtualVirgin Ah, sorry I misunderstood
-
@ulrik said in Trying to make a factory method but getting an error:
@VirtualVirgin Ah, sorry I misunderstood
Thanks for checking it out though :)
-
@VirtualVirgin The issue is caused because of your naming system.
Your button variable is called "button" and the laf function you are trying to assign is called... "button"
Now outside of the inline function HISE manages to resolve the LAF namespace properly and avoid the conflict but within the inline function
local
variables take precedence.So instead of calling your component variable button, call it something like
btnBasic
. -
@d-healey Oh man! Looks so obvious when you point it out!
Thanks :) -
@VirtualVirgin said in Trying to make a factory method but getting an error:
Looks so obvious when you point it out!
Yep, but it still took me at least 30 minutes to figure out what was going on.