Combining string and server response object data
-
I have a text which is a combination of string and server response object data like this:
"New Version (v" + response.CurrentVersion") is available. Click to Download"
How can I print this text inside a Panel with Paint Routine? Below one doesn't work.
const var PrintedText = "New Version (v" + response.CurrentVersion") is available. Click to Download"; Panel1.setPaintRoutine(function(g, h) { g.setColour(0xFFFFFFFF); g.setFont("Arial", 13); g.drawAlignedText(PrintedText, [0, 10, 207, 20], "centred"); });
-
Your paint routine is fine. Your text string is not valid (try using Console.print() to test it)
-
@d-healey it says undefined. How can I convert this object data to a string?
-
Your string is not formed correctly, you are missing a
+
-
@d-healey When I remove the +, it still doesn't work.
If you want to teach me, you just can do it with writing the solution, no need to make me struggle man :)
Besides if I would know how to combine with these different data types, I wouldn't ask ;)
-
@Steve-Mohican said in Combining string and server response object data:
@d-healey When I remove the +, it still doesn't work.
If you want to teach me, you just can do it with writing the solution, no need to make me struggle man :)
Besides if I would know how to combine with these different data types, I wouldn't ask ;)
I dont think you read what Dave said -- he didnt say remove a +, he said you were missing one.
As he said - use Console.print to debug your code... then you wouldnt need to ask at all...
-
@Steve-Mohican said in Combining string and server response object data:
no need to make me struggle
Best way to learn ;)
const var PrintedText = "New Version (v" + response.CurrentVersion + ") is available. Click to Download";
-
@d-healey said in Combining string and server response object data:
@Steve-Mohican said in Combining string and server response object data:
no need to make me struggle
Best way to learn ;)
You're right, that's something that I'll never forget. Thank you so much mate, you are the Best!