Topic: Justify text alignment in memo field

Has anyone created a script to justify text in a memo field?

Roberto Alencar

Re: Justify text alignment in memo field

Hi Roberto,
Not sure how you could do this;  as I understand it, TMemo only supports left-hand justification.
Derek.

Re: Justify text alignment in memo field

Hi Derek, Roberto

Roberto ,
Memo supports left, center and right alignment. Unfortunately, it doesn't support justified text alignment.
Memo displays information as plain text, and the only way to do this is by adding extra spaces between words,
and it's only for viewing. Character widths vary across fonts. We'll need to calculate word widths, etc. Maybe I'll give it a try.
For now, I've tried this:
To view notes, you can try using RichEdit, as in the example below. It uses justified text alignment. You can change the font and its size.
It's just a window similar to Memo. The downside is that RichEdit requires manual output processing
(for example: Form1.RichEdit.Text := SQLExecute (' SELECT text FROM ....' ). Accordingly, saving text from RichEdit also requires
manual processing.
Whether the game is worth the effort is up to you.

Post's attachments

Attachment icon ins_repl-memo TrichEdit.rar 114.71 kb, 182 downloads since 2025-09-23 

Re: Justify text alignment in memo field

sparrow wrote:

Hi Derek, Roberto

Roberto ,
Memo supports left, center and right alignment. Unfortunately, it doesn't support justified text alignment.
Memo displays information as plain text, and the only way to do this is by adding extra spaces between words,
and it's only for viewing. Character widths vary across fonts. We'll need to calculate word widths, etc. Maybe I'll give it a try.
For now, I've tried this:
To view notes, you can try using RichEdit, as in the example below. It uses justified text alignment. You can change the font and its size.
It's just a window similar to Memo. The downside is that RichEdit requires manual output processing
(for example: Form1.RichEdit.Text := SQLExecute (' SELECT text FROM ....' ). Accordingly, saving text from RichEdit also requires
manual processing.
Whether the game is worth the effort is up to you.


Hi Sparrow and Derek! I was familiar with justified alignment in RTF. I saw that in MEMO this is complicated, because RTF aligns by increasing the space size...but thank you both for your intention.

Roberto Alencar

5 (edited by k245 2025-09-23 16:09:04)

Re: Justify text alignment in memo field

--- >
https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=11266&download=0

Post's attachments

Attachment icon img-2025-09-23-19-06-54.png 38.38 kb, 135 downloads since 2025-09-23 

Визуальное программирование: блог и телеграм-канал.