明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3561|回复: 4

用get_tile函数获得的下拉列表框的值是什么?字符串?还是数值?

[复制链接]
发表于 2012-10-22 11:27 | 显示全部楼层 |阅读模式
  1. dia7c:dialog{
  2. label="下拉选单的词库范例";
  3. :list_box{
  4. label="常用词库选单";
  5. key="klist";
  6. width=30;
  7. height=10;
  8. fixed_width_font=true;
  9. }
  10. :edit_box{label="词库";key="wordstr";}
  11. :row{
  12. fixed_width=true;
  13. alignment=centered;
  14. :edit_box{label="字高";key="txthh";edit_width=4;}
  15. :popup_list{        //下拉选单1
  16. key="pophh";
  17. edit_width=4;
  18. }
  19. :edit_box{label="角度";key="txtang";edit_width=4;}
  20. :popup_list{        //下拉选单2
  21. key="popang";
  22. edit_width=4;
  23. }
  24. }
  25. spacer_1;
  26. ok_cancel;
  27. }
  1. (defun c:dia7c()
  2.    (setvar "cmdecho" 0)
  3.    (setq word_list'("平面图" "立面图"  "总经理室" "楼梯间"
  4.                     "弹簧"   "螺丝"    "传真机" "翔虹信息"
  5.                     "翔虹AutoCAD技术中心"
  6.                     "AutoCAD 2000特训教材"
  7.                     "道路" "桥梁" "捷运系统" "高速铁路" "规格表"))
  8.    (setq pophh_list '("5" "10" "20" "30" "40" "50"))
  9.    (setq popang_list '("0" "30" "45" "60" "75" "90" "-30" "-45" "-60"))
  10.    (chk_style)
  11.    (dcl_dia7c)
  12.    (prin1)
  13. )
  14. (defun dcl_dia7c()
  15.    (setq dcl_id (load_dialog "dia7c"))
  16.    (new_dialog "dia7c" dcl_id)
  17.    (show_list "klist" word_list)
  18.    (show_list "pophh" pophh_list)
  19.    (show_list "popang" popang_list)
  20.    (set_tile "klist" "8")
  21.    (sub_klist1 "8")
  22.    (set_tile "txthh" "10")
  23.    (set_tile "txtang" "0")
  24.    (action_tile "klist" "(sub_klist1 $value)")
  25.    (action_tile "pophh" "(sub_pophh $value)")
  26.    (action_tile "popang" "(sub_popang $value)")
  27.    (action_tile "accept" "(ok_dia7c)(done_dialog 1)")
  28.    (setq dd(start_dialog))
  29.    (if (= dd 1)
  30.        (progn
  31.            (setq inspt (getpoint "文字写入点:"))
  32.            (command "text" inspt txthh txtang wordstr)
  33.        )
  34.    )
  35. )
  36. (defun show_list(key newlist)
  37.    (start_list key)
  38.    (mapcar 'add_list newlist)
  39.    (end_list)
  40. )
  41. (defun sub_klist1(vvs)
  42.    (setq oldstr(get_tile "wordstr"))
  43.    (setq newstr(nth (atoi vvs) word_list))
  44.    (set_tile "wordstr" (strcat oldstr newstr))
  45. )
  46. (defun sub_pophh(vvs)
  47.    (set_tile "txthh" (nth (atoi vvs) pophh_list))
  48. )
  49. (defun sub_popang(vvs)
  50.    (set_tile "txtang" (nth (atoi vvs) popang_list))
  51. )
  52. (defun ok_dia7c()
  53.    (setq wordstr(strcase (get_tile "wordstr")))
  54.    (setq txthh  (get_tile "txthh"))
  55.    (setq txtang (get_tile "txtang"))
  56. )
  57. (defun chk_style();检查字型
  58.      (setq chksty(tblsearch "style" "kk"))
  59.      (if (null chksty)
  60.                (command "_style" "kk" "细明体" "" "" "" "" "" )
  61.      )
  62.      (setq chklay(tblsearch "layer" "txt"))
  63.      (if (null chklay)
  64.                (command "_layer" "m" "txt" "c" "3" "txt" "")
  65.      )
  66.      (setvar "clayer" "txt")
  67.      (setvar "textstyle" "kk")
  68. )
问题如下:
红色区域中,用get_tile函数获得的下拉列表框的值是字符串型,也就是txthh和txtang都是字符串类型,在绿色区域中对应的应该是整数或实数型(比如8或8.5之类)才对吧。我加载后发现上面的代码也可以运行无误,不知道是为什么?想来想去不明白!

还有个问题,上传的程序加载不一样能运行,因为我的电脑没有细明体这个字体,而且变成宋体也加载不成功,只能加载如:txt.shx,times.shx之类的字体,加载能成功,但是文字是乱码!

本帖子中包含更多资源

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

x
 楼主| 发表于 2012-10-22 11:32 | 显示全部楼层
本帖最后由 chenlight 于 2012-10-22 11:34 编辑

因不太会使用着色,现截图出来,以下是红色区域的内容
以下是绿色区域的内容





本帖子中包含更多资源

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

x
发表于 2013-5-28 20:11 | 显示全部楼层
得到的是字符格式
发表于 2013-7-27 22:52 | 显示全部楼层
程序列表字库在文本框显示,要是能清空再显示会好点,还有下拉列表直接能输入数字会方便很多
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-25 17:23 , Processed in 0.256461 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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