Line breaks with Text in a panel

368 views
Skip to first unread message

Daniel Pers

unread,
Aug 24, 2017, 4:51:10 AM8/24/17
to CoSpaces Scripting
I use a Panel to display text with Blocly. See the example below.

How can I easily insert line breaks (the equivalent of \n) after each variable in this text?
I would prefer not to create a text for each variable.
Thank you for your help.

Daniel Pers


Stefan Filff

unread,
Aug 25, 2017, 11:53:33 AM8/25/17
to cospaces-...@googlegroups.com
Hi Daniel,

we'll look into a way to easily create line breaks (maybe even within the text cell itself). In the meantime you can use the Coding block to define the variable, too.

This is the code that you can paste into the code block, which replaces the block defined in your example for now. Make sure that the capitalisation of the variables you created in Blockly (even if they're not used by blocks in the workspace) are the same in the Coding block, too.
Text1 = "t= " + t + " s \n Altitude = " + z + " m \n Speed = " + dz + " m/s \n Acceleration = " + a + " m/s2";


Cheers, 

Stefan

Daniel Pers

unread,
Aug 25, 2017, 4:26:30 PM8/25/17
to CoSpaces Scripting
Thank you very much Stefan,

Your solution has helped me find another solution that I find easier to use for students. They can manage their display without using JavaScript.



I also give an example block in Blockly Arduino to manage a Line Break when you want to display a variable on the PC screen :


Daniel

Reply all
Reply to author
Forward
0 new messages