Is it possible to write on Canvas so that a long text is automatically formatted over multiple lines instead of a single line? As in a textbox with a defined width size
Thank you
Is it possible to write on Canvas so that a long text is automatically formatted over multiple lines instead of a single line? As in a textbox with a defined width size
Thank you
You would need to split the long text to individual lines and write/draw a positioned text for each. The text function on the canvas will only draw a single line.
An alternative is to set your text to a label, and use the component to image extension to make an image of your label, then set this to a imageSprite on the canvas.
An example of the former (note that this will split words):
canvasMultiLineText.aia (3.5 KB)
Thank you for the quick reply.
I'll check if it can be suitable for my project, I did someting similar by splitting the text in a list but I got just a multiline text of single words.
I'll let you know, thank you
Thank you TIM, I tried the program and it could also work for my project. However, the problem I had encountered in previous attempts is that words are cut off when it starts writing the subsequent lines, naturally without keeping into account the grammar rules.
The basic idea would be to create a list containing parts of the text that should meet two conditions: being at least 50 characters long (for exemple) and being split at a space between two words. If they are not long at least 50 characters they shoudn't be splitted.
I tried but without success
Essentially, this is what my second example does ?
Sorry! I tried the first one with my projet, I have just finished to check the second....it works perfectly
Thank you very much, great solution
(added to FAQ)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.