明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2689|回复: 3

(列表框设计)练习出错,帮忙看下哪里出错了

[复制链接]
发表于 2011-12-26 16:48:53 | 显示全部楼层 |阅读模式
(defun c:dia7b()
  (setvar "cmdecho" 0)
  (setq word_list '("平面图" "立体图" "总经理室" "楼梯阁" "弹簧" "传真机" "教育中心" "规格表"))
  (chk_style)
  (dcl_dia7b)
  (prin1)
  )
(defun dcl_dia7b()
  (setq dcl_id (load_dialog "dia7b"))
  (new_dialog "dia7b" dcl_id)
  (show_list "klist" word_list)
  (set_tile "klist" "4")
  (sub_klist1 "1")
  (action_tile "klist" "(sub_klist1 $value)")
  (action_tile "accept" "(ok_dia7b)(done_dialog 1)")
  (setq dd (start_dialog))
  (if (= dd 1)
    (progn
      (setvar "cmdecho" 1)
      (command "text" pause pause 0 wordstr)
      (setvar "cmdecho" 0)
      )
    )
  )
(defun show_list(key newlist)
  (start_list key)
  (mapcar 'add_list newlist)
  (end_list)
  )
(defun sub_klist1(vvs)
  (setq oldstr (get_tile "wordstr"));没有数据
  (setq newstr (nth (atoi vvs) word_list))
  (set_tile "wordstr" (strcat (oldstr newstr)));提示这里出错
  )
(defun ok_dia7b()
  (setq wordstr(strcase (get_tile "wordstr")))
  )
(defun chk_style()
  (setq chksty (tblsearch "style" "kk"))
  (if (null chksty)
    (command "_style" "kk" "黑体" "" "" "" "" "" )
    )
  (if (null chklay)
    (command "_layer" "m" "txt" "c" "3" "txt" "")
    )
  (setvar "clayer" "txt")
  (setvar "textstyle" "kk")
  )
对话框文件:
dia7b:dialog{
label="列表框的专家词库范例";
:list_box{
  label="常用词库选单";
  key="klist";
  width=30;
  height=10;
}
:edit_box{
  label="词库";
  key="wordstr";
  }
  spacer_1;
  ok_cancel;
}


该贴已经同步到 mmh1的微博
 楼主| 发表于 2011-12-26 18:58:30 | 显示全部楼层
(set_tile "wordstr" (strcat (oldstr newstr)));此处多了个括号
(set_tile "wordstr" (strcat oldstr newstr))
发表于 2011-12-26 19:16:41 | 显示全部楼层
本帖最后由 chg 于 2011-12-26 19:46 编辑

(defun sub_klist1(vvs)
  (setq oldstr (get_tile "wordstr"));没有数据
  (setq newstr (nth (atoi vvs) word_list))
  (if (null oldstr) (setq oldstr ""))
  (set_tile "wordstr" (strcat oldstr newstr));提示这里出错
  )
 楼主| 发表于 2011-12-26 20:29:28 | 显示全部楼层
本帖最后由 mmh1 于 2011-12-26 20:31 编辑
  1. (defun c:dia7b()
  2.   (setvar "cmdecho" 0)
  3.   (setq word_list '("平面图" "立体图" "总经理室" "楼梯阁" "弹簧" "传真机" "教育中心" "规格表"))
  4.   (chk_style)
  5.   (dcl_dia7b)
  6.   (prompt "<<dia7b>>框设计......连续选")
  7.   )
  8. (defun dcl_dia7b()
  9.   (setq dcl_id (load_dialog "dia7b"))
  10.   (new_dialog "dia7b" dcl_id)
  11.   (show_list "klist" word_list)
  12.   (action_tile "klist" "(sub_klist1 $value)")
  13.   (action_tile "accept" "(ok_dia7b)(done_dialog 1)")
  14.   (setq dd (start_dialog))
  15.   (if (= dd 1)
  16.     (progn
  17.       (setvar "cmdecho" 1)
  18.       (command "text" pause pause 0 wordstr)
  19.       (setvar "cmdecho" 0)
  20.       )
  21.     )
  22.   )
  23. (defun show_list(key newlist)
  24.   (start_list key)
  25.   (mapcar 'add_list newlist)
  26.   (end_list)
  27.   )
  28. (defun sub_klist1(vvs)
  29.   (setq oldstr (get_tile "wordstr"))
  30.   (setq newstr (nth (atoi vvs) word_list))
  31.   (set_tile "wordstr" (strcat oldstr newstr))
  32.   )
  33. (defun ok_dia7b()
  34.   (setq wordstr(strcase (get_tile "wordstr")))
  35.   )
  36. (defun chk_style()
  37.   (setq chksty (tblsearch "style" "kk"))
  38.   (if (null chksty)
  39.     (command "_style" "kk" "黑体" "" "" "" "" "" "")
  40.     )
  41.   (if (null chklay)
  42.     (command "_layer" "m" "txt" "c" "3" "txt" "")
  43.     )
  44.   (setvar "clayer" "txt")
  45.   (setvar "textstyle" "kk")
  46.   )
找到答案了,这样就可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-23 12:03 , Processed in 0.180291 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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