Jump to content

dcl - what is the difference between text and text_part


Recommended Posts

Posted

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

  [color=red]:[/color] [color=blue]text[/color][color=red]{[/color]
   [color=blue]label[/color] [color=red]=[/color] [color=magenta]"This is a Test Message"[/color][color=red];[/color]
   [color=blue]alignment[/color] [color=red]=[/color] [color=blue]centered[/color][color=red];[/color]
[color=red] }[/color]
 
 [color=red]:[/color] [color=blue]text_part[/color][color=red]{[/color]
   [color=blue]label[/color] [color=red]=[/color] [color=magenta]"This is a Test Message"[/color][color=red];[/color]
   [color=blue]alignment[/color] [color=red]=[/color] [color=blue]centered[/color][color=red];[/color]     
 [color=red]}[/color] 

and the output seemed exactly the same. Is there any difference?

Posted

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;
 :[color=blue] text[/color] {
  key   = "t11";
  value = "ABCDEF";
  width = 5;
 }
 : text {
  key   = "t12";
  value = "12345";
  width = 4;
 }
}
: row {
 fixed_width = true;
 :[color=magenta] text_part[/color] {
  key   = "t21";
  value = "ABCDEF";
  width = 5;
 }
 : text {
  key   = "t22";
  value = "12345";
  width = 4;
 }
}
ok_only;
}

Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...