明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 286|回复: 9

求教,如何按钮居中

[复制链接]
发表于 2024-4-9 08:34 | 显示全部楼层 |阅读模式
(defun c:gh ( )  (vl-load-com)
  (setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl_addgc))))
  (vl-file-delete Dcl_File)
  (setq Dialog_Return 2)
  ;(while (> Dialog_Return 1)
    (new_dialog "gh" dcl_id)
    (setq keys '("G1N" "G1Y" "G1X" "G2N" "G2Y" "G2X" "G3N" "G3Y" "G3X" "BCH1" "BCH2" "SJ1" "JD1" "JD2" "G0" "BCQ1" "BCQ2" "SJ2"  "accept" "cancel" "help" "bg"))

    (foreach key keys (action_tile key "(Action_addxy_Keys $key $value)"))
     (setq Dialog_Return (start_dialog))
     ;(cond
       ; ((= Dialog_Return 3)
          ;(start_gh)

            ;(unload_dialog dcl_id)

        ; (alert "why")
        ;)
    ;)
  ;)
  ;(unload_dialog dcl_id)
  (princ)
)

(defun start_gh ( )
           (set_tile "G1g" "n")  (set_tile "G1gy" G1Y) (set_tile "G1gx" "x")
           (set_tile "G2g" "n")  (set_tile "G2gy" "y") (set_tile "G2gx" "x")
           (set_tile "G3g" "n")  (set_tile "G3gy" "y") (set_tile "G3gx" "x")
           (alert "计算成功。")
)

(defun Action_addxy_Keys (key Value)
  ;(alert "该函数不可用。")
  (cond
    ((= key "accept")


      (done_dialog 0)
   )
   ((= key "help") (alert "给赵帅哥打电话"))
   ((= key "bg")
           (setq G1N  (get_tile "G1N")    G1Y (get_tile "G1Y")   G1X (get_tile "G1X")
            G2N  (get_tile "G2N")    G2Y (get_tile "G2Y")   G2X (get_tile "G2X")
            G3N  (get_tile "G2N")    G3Y (get_tile "G3Y")   G3X (get_tile "G3X")
            BCH1 (get_tile "BCH1")  BCH2 (get_tile "BCH2")  SJ1 (get_tile "SJ1")
            JD1  (get_tile "JD1")    JD2 (get_tile "JD2")    G0 (get_tile "g0")
            BCQ1 (get_tile "BCQ1")  BCQ2 (get_tile "BCQ2")  SJ2 (get_tile "SJ2")
          )
         (start_gh) (alert "执行写成果函数!GH_bg"))
   ((= key "cancel") (done_dialog 0))
  )
)
(defun GHlist (G1 G2 G3 dist jd)
   (alert "该函数不可用。")
)
(defun GHbg (G1 G2 G3 dist jd)
  (alert "该函数不可用。")
)
(defun Write_Dcl_addgc ( / Dcl_File file str)
  (setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
  (setq file (open Dcl_File "w"))
  (foreach str '(
                     "gh:dialog {"
                     "    height = 30 ;"
                     "    key = \"1\" ;"
                     "    label = \"GPSRTK3点坐标归化\" ;"
                     "    width = 35 ;"
                     "    :boxed_column {"
                     "        children_fixed_height = true ;"
                     "        children_fixed_width = true ;"
                     "        height = 9 ;"
                     "        label = \"GPS坐标\" ;"
                     "        width = 7 ;"
                     "        :row {"
                     "            :boxed_column {"
                     "                is_enabled = false ;"
                     "                :text {"
                     "                    label = \" 点名\" ;"
                     "                }"
                     "                :text {"
                     "                    label = \"  Y  \" ;"
                     "                }"
                     "                :text {"
                     "                    label = \"  X  \" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1N\" ;"
                     "                    value = \"G1\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1Y\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1X\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2N\" ;"
                     "                    value = \"G2\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2Y\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2X\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3N\" ;"
                     "                    value = \"G3\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3Y\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3X\" ;"
                     "                }"
                     "            }"
                     "        }"
                     "    }"
                     "    :boxed_column {"
                     "        children_fixed_height = true ;"
                     "        children_fixed_width = true ;"
                     "        height = 9 ;"
                     "        label = \"观测数据\" ;"
                     "        width = 7 ;"
                     "        :row {"
                     "            :boxed_column {"
                     "                :text {"
                     "                    label = \" 后视\" ;"
                     "                }"
                     "                :text {"
                     "                    label = \" 测站\" ;"
                     "                }"
                     "                :text {"
                     "                    label = \" 前视\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 10 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"HS\" ;"
                     "                    value = \"G1\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"CZ\" ;"
                     "                    value = \"G2\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"QS\" ;"
                     "                    value = \"G3\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                :text {"
                     "                    label = \" 距离\" ;"
                     "                }"
                     "                :text {"
                     "                    label = \" 角度\" ;"
                     "                }"
                     "                :text {"
                     "                    label = \" 距离\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 25 ;"
                     "                :row {"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"BCH1\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"BCH2\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        alignment = left ;"
                     "                        edit_width = 4 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"SJ1\" ;"
                     "                        value = \"90\" ;"
                     "                    }"
                     "                }"
                     "                :row {"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"JD1\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"JD2\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        alignment = left ;"
                     "                        edit_width = 4 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"G0\" ;"
                     "                    }"
                     "                }"
                     "                :row {"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"BCQ1\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        edit_width = 9 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"BCQ2\" ;"
                     "                    }"
                     "                    :edit_box {"
                     "                        alignment = left ;"
                     "                        edit_width = 4 ;"
                     "                        height = 1.2 ;"
                     "                        key = \"SJ2\" ;"
                     "                        value = \"90\" ;"
                     "                    }"
                     "                }"
                     "            }"
                     "        }"
                     "    }"
                     "    :boxed_column {"
                     "        children_fixed_height = true ;"
                     "        children_fixed_width = true ;"
                     "        height = 9 ;"
                     "        label = \"成果数据\" ;"
                     "        width = 7 ;"
                     "        :row {"
                     "            :boxed_column {"
                     "                :text {"
                     "                    label = \" 点名 \" ;"
                     "                }"
                     "                :text {"
                     "                    label = \"  Y  \" ;"
                     "                }"
                     "                :text {"
                     "                    label = \"  X  \" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1g\" ;"
                     "                    value = \"G1g\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1gy\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G1gx\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2g\" ;"
                     "                    value = \"G2g\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2gy\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G2gx\" ;"
                     "                }"
                     "            }"
                     "            :boxed_column {"
                     "                height = 2 ;"
                     "                width = 16 ;"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3g\" ;"
                     "                    value = \"G3g\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3gy\" ;"
                     "                }"
                     "                :edit_box {"
                     "                    height = 1.2 ;"
                     "                    key = \"G3gx\" ;"
                     "                }"
                     "            }"
                     "        }"
                     "    }"
                             "    :boxed_column {"
                             "                height = 2 ;"
                     "                width = 35 ;"
                     "        :row {"
                     "            alignment = centered ;"
                             "        :button {"
                     "            alignment = left ;"
                     "            fixed_height = true ;"
                     "            fixed_width = true ;"
                     "            key = \"bg\" ;"
                     "            label = \"计算\" ;"
                     "        }"
                             "        :button {"
                     "            alignment = left ;"
                     "            fixed_height = true ;"
                     "            fixed_width = true ;"
                     "            key = \"help\" ;"
                     "            label = \"帮助\" ;"
                     "        }"
                             "        ok_only;"
                     "    }"
                     "    }"
                     "}"
    )
    (write-line str file)
  )
  (close file)
  Dcl_File
)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2024-4-9 08:51 | 显示全部楼层
最下三个是均布的,可以加spacer_1,text_box之类的占位,这样 就可调位置了
发表于 2024-4-9 09:25 | 显示全部楼层
哈哈,强迫症,分布不是挺好的嘛
 楼主| 发表于 2024-4-9 09:36 | 显示全部楼层
自贡黄明儒 发表于 2024-4-9 08:51
最下三个是均布的,可以加spacer_1,text_box之类的占位,这样 就可调位置了

黄师傅,在下,大同赵小兵 欢迎到大同去旅游。谢谢您,偷师于你。
 楼主| 发表于 2024-4-9 09:39 | 显示全部楼层
ssyfeng 发表于 2024-4-9 09:25
哈哈,强迫症,分布不是挺好的嘛

大师,让您见笑了,和您也学了不少,看您总热心的帮助我这样的菜鸟。
发表于 2024-4-9 09:47 | 显示全部楼层
还可以用这个

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2024-4-9 09:47 | 显示全部楼层
将最后那个boxed_column,
                             "    :boxed_column {"
                             "                height = 2 ;"
                     "                width = 35 ;"
                     "        :row {"
                     "            alignment = centered ;"
                             "        :button {"
                     "            alignment = left ;"
                     "            fixed_height = true ;"
                     "            fixed_width = true ;"
                     "            key = \"bg\" ;"
                     "            label = \"计算\" ;"
                     "        }"
                             "        :button {"
                     "            alignment = left ;"
                     "            fixed_height = true ;"
                     "            fixed_width = true ;"
                     "            key = \"help\" ;"
                     "            label = \"帮助\" ;"
                     "        }"
                             "        ok_only;"
                     "    }"
                     "    }"
改为如下即可
                     "    :boxed_column "
                     "    {"
                     "        :row "
                     "        {"
                     "            alignment = centered ; "
                     "            fixed_width = true ; "
                     "            : button { label = \"计算\" ;  key = \"bg\" ; height=3 ; }"
                     "            : spacer { width = 1.0; }"
                     "            : button { label = \"帮助\" ;  key = \"help\" ; height=3 ; }"
                     "            : spacer { width = 1.0; }"
                     "            : button { label = \"确定\" ;  key = \"accept\" ; is_default = true ; height=3 ; }"
                     "        }"
                     "    }"
 楼主| 发表于 2024-4-9 09:53 | 显示全部楼层

大侠出手,一剑封喉。
 楼主| 发表于 2024-4-9 09:56 | 显示全部楼层
yshf 发表于 2024-4-9 09:47
将最后那个boxed_column,
                             "    :boxed_column {"
                       ...

名师一句话,教会笨和尚。
发表于 2024-4-9 13:49 | 显示全部楼层
谢谢分享谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-30 19:50 , Processed in 0.397998 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表