明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1622|回复: 2

[提问] 请教toggle获得返回值的问题

[复制链接]
发表于 2013-6-16 20:04 | 显示全部楼层 |阅读模式
各位,请教一下以下LSP中,为什么toggle的取值(get_tile "com")会是NIL。
  1. (Defun C:test (/ Fn Lsdcl X Dcl_Id Re Vlxpath Inpath)
  2.    (Setq Fn (Open (Setq Lsdcl (Vl-Filename-Mktemp "Tmp" "" ".Dcl")) "W"))
  3.    (Foreach X
  4.      (List
  5.        "path:dialog {label="程序 ay编制";" "spacer;"
  6.            ":row {label="路径";" "alignment=centered;"
  7.              ":button {label="浏览";key="vlxPath";}"
  8.              ":edit_box {key="Pathtxt";edit_width=24;} }"" spacer_1;"
  9.            ":row {label="加载命令";"
  10.              ":toggle {label="第一次提示";key="com";}"
  11.              ":toggle {label="第二次提示";key="info";} }"" spacer_1;"
  12.        "ok_cancel_help;} ")
  13.     (Write-Line X Fn))
  14.    (Close Fn)
  15.    (Setq Dcl_Id (Load_Dialog Lsdcl))
  16.    (Vl-File-Delete Lsdcl)
  17.    (Setq Re 11)
  18.    (While (> Re 10)
  19.      (If (New_Dialog "path" Dcl_Id)
  20.        (Progn
  21.          (Action_Tile "vlxPath" "(Done_Dialog 11)")
  22.    (If (/= Vlxpath NIL) (Setq Inpath (Set_tile "Pathtxt" (Vl-Filename-Directory Vlxpath)) ) )
  23.    (set_tile "com" "1") (set_tile "info" "1")
  24.    (Action_Tile "Accept" "(Setup_Ok) (Done_Dialog 1)")
  25.          (Action_Tile "Cancel" "(Done_Dialog 0)")
  26.          (Action_Tile "Help" "(Help "aylisp.Chm")")
  27.    (Setq re (Start_Dialog)) ) )
  28.      (If (= Re 11) (Setq Vlxpath (Getfiled "选择程序文件" "12.lsp" "lsp" 0))) )
  29.    (IF (= Re 1)(Setup_Ok) )
  30.    (setq com (get_tile "com"))
  31.    (Unload_Dialog Dcl_Id)
  32.    (Princ)
  33.   )


  34. (defun Setup_Ok()
  35.   (progn (If (= (get_tile "com") "1") (alert "第一次提示!"))
  36.          (If (= (get_tile "info") "1") (alert "第二次提示!")) ) )

本帖子中包含更多资源

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

x
发表于 2013-6-16 21:48 | 显示全部楼层
(setq com (get_tile "com"))
放在了(Start_Dialog)之后了,意味着已经跳出了对话框,(get_tile "com")当然为nil了!这句代码要放在前面:
(action_tile "com" "(setq com $value)")
 楼主| 发表于 2013-6-16 22:12 | 显示全部楼层
这样子吗?也不行啊
  1. (Defun C:test (/ Fn Lsdcl X Dcl_Id Re Vlxpath Inpath Com Info)
  2.    (Setq Fn (Open (Setq Lsdcl (Vl-Filename-Mktemp "Tmp" "" ".Dcl")) "W"))
  3.    (Foreach X
  4.      (List
  5.        "path:dialog {label="程序 ay编制";" "spacer;"
  6.            ":row {label="路径";" "alignment=centered;"
  7.              ":button {label="浏览";key="vlxPath";}"
  8.              ":edit_box {key="Pathtxt";edit_width=24;} }"" spacer_1;"
  9.            ":row {label="加载命令";"
  10.              ":toggle {label="第一次提示";key="com";value=1;}"
  11.              ":toggle {label="第二次提示";key="info";value=1;} }"" spacer_1;"
  12.        "ok_cancel_help;} ")
  13.     (Write-Line X Fn))
  14.    (Close Fn)
  15.    (Setq Dcl_Id (Load_Dialog Lsdcl))
  16.    (Vl-File-Delete Lsdcl)
  17.    (Setq Re 11)
  18.    (While (> Re 10)
  19.      (If (New_Dialog "path" Dcl_Id)
  20.        (Progn
  21.          (Action_Tile "vlxPath" "(Done_Dialog 11)")
  22.          (If (/= Vlxpath NIL) (Setq Inpath (Set_tile "Pathtxt" (Vl-Filename-Directory Vlxpath)) ) )
  23. ;;;         (set_tile "com" "1") (set_tile "info" "1")
  24.          (action_tile "com" "(setq com $value)")
  25.          (action_tile "info" "(setq info $value)")
  26.          (Action_Tile "Accept" "(Setup_Ok) (Done_Dialog 1)")
  27.          (Action_Tile "Cancel" "(Done_Dialog 0)")
  28.          (Action_Tile "Help" "(Help "aylisp.Chm")")
  29.          (Setq re (Start_Dialog)) ) )
  30.      (If (= Re 11) (Setq Vlxpath (Getfiled "选择程序文件" "12.lsp" "lsp" 0))) )
  31.    (IF (= Re 1)(Setup_Ok) )
  32.    (setq com (get_tile "com"))
  33.    (Unload_Dialog Dcl_Id)
  34.    (Princ)
  35.   )


  36. (defun Setup_Ok(/ Com Info)
  37.   (progn (If (= Com "1") (alert "第一次提示!"))
  38.          (If (= Info "1") (alert "第二次提示!")) ) )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-2 22:52 , Processed in 0.410331 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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