逗亦斗霸 发表于 2025-1-24 09:11:26

根据对话框选择项目生成表格问题求助,谢谢~

(defun c:tt (/ make_dcl)
(defun make_dcl(/ lst_str str file f) ; ; 面板的界面显示dcl
    (setq lst_str
      '(
"dcl_test:dialog                                                "
"{alignment=centered;label = \"试用\";                                    "
":boxed_column                                                "
"    {fixed_height = true; label = \"非必选项\";                                  "
":toggle {key = \"xx_1\"; label = \"选项1\";}                                    "
":toggle {key = \"xx_2\"; label = \"选项3\";}                                    "
":toggle {key = \"xx_3\"; label = \"选项4\";}                                    "
":toggle {key = \"xx_4\"; label = \"选项6\";}                                    "
":toggle {key = \"xx_5\"; label = \"选项9\";}                                    "
"      spacer_0;                                                "
"    }                                                      "
"    :row{                                                    "
"    :button {key = \accept\;is_default = true;   fixed_width = true; label = \"确定\";}            "
"    :button {key = \"cancel\";   is_cancel = true;   fixed_width = true; label = \"取消\";}            "
"      }                                                    "
"      }                                                    "
      )
    )
    (setq file (vl-filename-mktemp "DclTemp.dcl") )
    (setq f (open file "w") )
    (foreach str lst_str
      (princ "\n" f)
      (princ str f)
    )
    (close f)
    file
)

(if (= (setq dcl_id (load_dialog (setq dcl_file (make_dcl) ) ) ) 0) (progn (exit) ) )
(if dcl_file (vl-file-delete dcl_file) )
    (if (not (new_dialog "dcl_test" dcl_id) ) (progn (exit) ) )

(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0) (exit)")
(start_dialog)
    (unload_dialog dcl_id)
)1.选项中的必选项和非必选项是无规律穿插的;
2.解决方案的行数选项对应,但行数不固定;
3.非必选项的选择数量也随机的。
最后根据选择的非必选项和默认已经选择的必选项生成表格。这样的代码该怎么写?用最原始的办法把每条的位置都写出来,再用cond来设置显示。如果选项少的话还行,选项多了就太难表达了,请问有没有好的表达方式?谢谢~

kozmosovia 发表于 2025-1-24 10:05:16

一种方式是生成表格前根据选择组织数据结构,然后生成。另外一种是直接先生成完整表格(ACAD_TABLE),然后删除不需要的行。

逗亦斗霸 发表于 2025-1-24 10:17:55

kozmosovia 发表于 2025-1-24 10:05
一种方式是生成表格前根据选择组织数据结构,然后生成。另外一种是直接先生成完整表格(ACAD_TABLE),然后 ...

第一种方式的话这个数据结构不知道怎么个组织法,选项少的话还能按最原始的来搭配,选项多的话直接让人崩溃;
第二种方式是话应该会用到整体移动这样的函数吧?(ACAD_TABLE)也还没接触过;
现在在尝试的是用(entlast)找上一个生成的横线坐标,目前处于失败状态,唉!有点难搞啊~

飞雪神光 发表于 2025-1-24 10:54:33

直接按照顺序拼接数据 统一生成 这还有什么疑问

逗亦斗霸 发表于 2025-1-24 11:06:31

飞雪神光 发表于 2025-1-24 10:54
直接按照顺序拼接数据 统一生成 这还有什么疑问

感谢飞版回复!因为选项数量不是固定的,与之对应的解决方案行数只相对固定,先前没想明白这个依附关系,刚用(entlast)找上一个生成的横线坐标解决问题了~

yefei812678 发表于 2025-1-24 12:20:31

谢谢分享谢谢分享
页: [1]
查看完整版本: 根据对话框选择项目生成表格问题求助,谢谢~