Jef! 发表于 2022-7-5 23:38:24

dcl - what is the difference b

Hi everyone! I like making lisps so much I've decided to go deeper and try making dcl menus. I found many sites with neat tutorials. I noticed that few use ": text {}"
while others use ": text_part {}" but couldn't find anywhere the difference (if any).
I also made a simple dialog using both simultaneously

: text{   label = "This is a Test Message";   alignment = centered; }: text_part{   label = "This is a Test Message";   alignment = centered;      } and the output seemed exactly the same. Is there any difference?

MSasu 发表于 2022-7-6 00:15:41

The difference is in the way the interpretor is alocating leading/tailing space for labels when dialog is shown; please test the below demo:

TEST : dialog {: row { fixed_width = true; : text {key   = "t11";value = "ABCDEF";width = 5; } : text {key   = "t12";value = "12345";width = 4; }}: row { fixed_width = true; : text_part {key   = "t21";value = "ABCDEF";width = 5; } : text {key   = "t22";value = "12345";width = 4; }}ok_only;}

Jef! 发表于 2022-7-6 00:41:08

mmm.. so text_part has no leading space and tail.. so using 2 text_part one after another is like having 1 single text.. that's why its named text_part. Logic.
 
Not very likely, but if someone didn't figure out why with MSasu's example, I'll illustrate with the 2 expressions below, both having the same width of 9 chars.
text_part =>(:text_part{)
text_only =>(:text{)
 
Since a text has leading/tailing space i'll represent it with " text_only " while i'll represent text_part with "text_part".
With Msasu's example this is why width change and the position shift slightly
" text_only "" text_only "
"text_part"" text_only "
 
 
Here are the 4 possibilities with 4 rows:
text_part/text_part
text_part/text
text/text_part
text/text
...all visually looking different even if they contain the same text.
"text_part""text_part"
"text_part"" text_only "
" text_only ""text_part"
" text_only "" text_only "
 
 
Thank you very much M.Sasu!
页: [1]
查看完整版本: dcl - what is the difference b