Bloc
Bloc copied to clipboard
[Question]- About not recognized Carriage Return (CR) character in BlTextElement
Good afternoon,
I am currently trying to convert some text containing some carriage return character : cr
into a BLTextElement
in order to display it on screen with other BlElements
.
However, when I display the text, the cr
characters are not recognized nor applied, only showing some "error" characters.
My text should be looking like that :
But it is shown like so:
In order to display my text , I use the function openInNewSpace
.
My text is also transformed first as a RopedText
so that I can apply some font and size on it and then I transform it as a BlTextElement
.
Also, when I look at my BlTextElement
, I can clearly see that the cr
is present:
Do you have an idea how I could solve this problem ?
Hello Elisabeth, BlTextElement is made to draw text but without any interpretation of its content. You can only have one line. To draw such a multi-line text you can use a label, a text field or a text editor widget. such widgets are available in Toplo and in Brick (but I don't know how to create a multi-line label with Brick).
with Toplo: | lab | lab := ToLabel text: 'Mme XX 28 allée de la mer, 29200 Brest'. lab beMultiLine. lab openInNewSpace.
Please notice that Toplo is currently under development.
For those who are not aware what Toplo is, it is a widget framework on top of Bloc (https://github.com/plantec/Toplo)
Hello Alain,
Thank you very much for those explanations. I will try them out.
We cannot use Toplo in this project for Text management. We can use Toplo for widgets management but here this is simple text element.
@tinchodias it is possible to display a text with carriage return ? BlRopedText have the CR information, how is it on Alexandrie ?
yes and no. A carriage return is a word processor concept. The CR character is stored in a BlRopedText ok but its interpretation/processing as a carriage return is done at the widget level.
@ElisabethCabioch propose to manage that with more BlElements (one per line) for our project, but it should be good to have a BlTextElement specialized to manage this basic display ?
Else, basically, how to do that without using Toplo ?
I would have a look at BlTextParagraph. It seems broken. I can make a try
bon, it is not so easy. text measuring is needed BlTextParagraph is not functional at all. I will come back on it later.
thanks @plantec