乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 100|回复: 2

[编程交流] dcl - what is the difference b

[复制链接]

28

主题

317

帖子

292

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2022-7-5 23:38:24 | 显示全部楼层 |阅读模式
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
  1.   [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?
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 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:
  1. 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;}
回复

使用道具 举报

28

主题

317

帖子

292

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 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!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 00:02 , Processed in 0.457142 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表