需要适当间距的帮助
你好我有一个对话框例程,我需要帮助我在其中的项目间距,使它看起来很好和专业。它还没有做任何事情,我想先算出间距,似乎是目前为止更难的部分。我附上了一个zip文件,其中包含所有代码和图像文件(如果需要的话),以及对话框当前外观的图像。
感谢您的时间和关注,非常感谢!
起草人Joe
幻灯片图像。拉链 DCL对话框中的每个互动程序都需要一定的空间。标签较长的瓷砖需要更多的水平空间。平均来说,对话框顶行中的平铺更宽,使其成为决定对话框总宽度的行。在最底层有一个水平空间,用来将瓷砖隔开。
创建正确垂直对齐的唯一方法是为大多数瓷砖提供宽度和固定宽度属性,并将每个瓷砖的宽度基于具有最长标签的相同类型的瓷砖。
[列表=1]
[*]请记住,每个标签的右侧都会添加一个边距。此边距约为文本宽度的30%。选择短标签以避免较大的边距。
[*]尝试使用更多描述性键。像“eb5”这样的词不是很清楚,“circInCircDia1”是。
[*]我个人会去掉单选按钮,将图像转换为image\u按钮。或者我会使用没有标签的“收音机”。
[/列表] 怎么样:
(defun c:tst ( / box_type dcl-id)
(setq box_type "rectangle" dcl-id (load_dialog "SlideImage.DCL"))
(new_dialog "Main_Dialog" dcl-id)(update_dialog)
(action_tile "rb_rectangle" "(setq box_type \"rectangle\")(update_Dialog)")
(action_tile "rb_rounded" "(setq box_type \"rounded\")(update_Dialog)")
(action_tile "rb_circle1" "(setq box_type \"circle1\")(update_Dialog)")
(action_tile "rb_circle2" "(setq box_type \"circle2\")(update_Dialog)")
(action_tile "accept" "(done_dialog 1)")
(action_tile "accept" "(done_dialog 0)")
(start_dialog)
(unload_dialog dcl-id)
(princ)
)
(defun update_dialog ( / x y slide)
(cond
((= box_type "rectangle")(setq slide (findfile "test1.sld"))(set_tile "rb_rectangle" "1"))
((= box_type "rounded")(setq slide (findfile "test2.sld"))(set_tile "rb_rounded" "1"))
((= box_type "circle1")(setq slide (findfile "test3.sld"))(set_tile "rb_circle1" "1"))
((= box_type "circle2")(setq slide (findfile "test4.sld"))(set_tile "rb_circle2" "1")))
(setq x (dimx_tile "im_box_type") y (dimy_tile "im_box_type"))
(start_image "im_box_type")
(fill_image 0 0 x y -2);wipe
(slide_image 0 -20 x y slide)
(end_image)
)
Main_Dialog : dialog { label = "Slide from Image";
: row {
: boxed_radio_column {
: radio_button { key = "rb_rectangle"; label = "Rectangle";}
: radio_button { key = "rb_rounded"; label = "Rounded";}
: radio_button { key = "rb_circle1"; label = "Circle1";}
: radio_button { key = "rb_circle2"; label = "Circle2";}}
: column {
: image { key = "im_box_type"; width = 14; height = 10; color = -2;}
: row {
: edit_box { key = "eb_dia1"; label = "Dia.1";}
: edit_box { key = "eb_dia2"; label = "Dia.2";}}
: row {
: edit_box { key = "eb_x"; label = " X= ";}
: edit_box { key = "eb_y"; label = " Y= ";}}
}
}
spacer;
ok_cancel;
}
Rlx级
@Rlx:
您正在标签中使用空格,试图对齐编辑框。正如您自己所见,垂直对齐并不完美(可能因标签使用的字体而异)。正如我在上一篇文章中所解释的,设置width和fixed_width属性是解决这个问题的方法。
吉普,我知道这一点,但因为它是一个很短的标签,这没有什么大不了的。为了达到完美效果,您可以创建一个包含4列的行,第一列用于dia1和X,第二列用于两个编辑框,第三列用于dia2和Y,最后一列用于其他编辑框。通常我会这样做,但标签很短,在这种情况下,效果很小。
但对于粉丝来说:
使用固定的宽度和高度有一些缺点,例如,当您想调整图像大小时,编辑框的大小将保持不变。使用colums,您的设计将随之展开。。。但那是2U。。。
gr.Rlx
嘿,伙计们!
@Roy_043:
谢谢Roy_043的建议!我会对名字进行修改,这样在我完成之前,更具描述性肯定是更好的方式。我最初的想法是让图片可以点击,我在上面发现的东西对我来说有点复杂。我会努力做到这一点和它的去向。
@rlx:
谢谢你,rlx的代码!你所拥有的肯定要精简得多。我喜欢我在这里看到的,漂亮整洁。我还没有机会测试你的代码,但我很快会的。
感谢你们和其他像你们这样的人,在这些论坛上帮助我们这些知道有更好的方法,但只是不太确定如何去做的人!
干杯 欢迎您成为drafter_joe。如果你愿意的话,我也可以制作一个带有可点击图片的版本,但有时尝试一下自己也有一半的乐趣:-)我确信我在这个论坛上已经有了一些帖子,有一些例子,只是我的用户名。首先想到的是RlxPaste。可以将“$reason”参数与操作磁贴代码一起使用。只要确保包含某种形式的数据检查,如果双击其中一个图像,则所单击类型所需的所有编辑框都具有有效值。
gr.Rlx rlx,
我感谢您提供的可点击图像。是的,在我按照你的建议进行搜索后,我会自己尝试一下,下次我有机会。如果我在这方面有任何进展,我会向你汇报。
我很好奇你在dcl工作的时间?对于我来说,你的代码非常紧凑。你受过正规教育还是自学?
非常感谢。
起草人Joe 附件是我对该程序的看法:就个人而言,我喜欢任何对话框图像作为界面的一部分嵌入,并且使用幻灯片库可以减少需要分发的文件数量。
AutoLISP代码:
(defun c:test ( / dch )
(cond
( (<= (setq dch (load_dialog "test.dcl")) 0)
(princ "\nUnable to find/load test.dcl file.")
)
( (not (new_dialog "test" dch))
(princ "\nUnable to display dialog.")
)
( (set_tile "dcl" "Slide Library Example")
(foreach key '("sl1""sl2""sl3""sl4")
(action_tile key "(updatetiles $key)")
)
(set_tile "sl1" "1")
(updatetiles "sl1")
(start_dialog)
)
)
(if (< 0 dch) (unload_dialog dch))
(princ)
)
(defun updatetiles ( key )
( (lambda ( x y )
(start_image "sld")
(fill_image 0 0 x y -15)
(slide_image 0 0 x y (strcat "test(" key ")"))
(end_image)
(mapcar 'mode_tile '("ed1""ed2""ed3""ed4""ed5")
(cadr
(assoc key
'( ("sl1" (0 0 1 1 1))
("sl2" (0 0 0 1 1))
("sl3" (1 1 1 0 1))
("sl4" (1 1 1 0 0))
)
)
)
)
)
(dimx_tile "sld") (dimy_tile "sld")
)
)
幻灯片B。拉链
看起来很棒,李!非常感谢。
是的,关于下面的代码部分,我有一两个问题。
edit : edit_box
{
edit_width = 12;
width = 20;
fixed_width = true;
}
test : dialog
{
key = "dcl"; spacer;
: row
{
spacer;
: radio_column
{
fixed_height = true;
: radio_button { label = "Rectangle"; key = "sl1"; }
: radio_button { label = "Rounded"; key = "sl2"; }
: radio_button { label = "Circle"; key = "sl3"; }
: radio_button { label = "Pipe"; key = "sl4"; }
}
: image
{
key = "sld";
width = 33.5;
fixed_width = true;
aspect_ratio = 0.66;
}
: column
{
fixed_height = true;
: edit { label = "X:";key = "ed1"; }
: edit { label = "Y:";key = "ed2"; }
: edit { label = "R:";key = "ed3"; }
: edit { label = "D1:"; key = "ed4"; }
: edit { label = "D2:"; key = "ed5"; }
}
spacer;
}
spacer_1; ok_cancel;
}
我想我可以看到这里发生了什么,这是编辑框可用还是不可用?
你能解释一下“1”和“0”吗?
乔
页:
[1]
2