用get_tile函数获得的下拉列表框的值是什么?字符串?还是数值?
dia7c:dialog{label="下拉选单的词库范例";
:list_box{
label="常用词库选单";
key="klist";
width=30;
height=10;
fixed_width_font=true;
}
:edit_box{label="词库";key="wordstr";}
:row{
fixed_width=true;
alignment=centered;
:edit_box{label="字高";key="txthh";edit_width=4;}
:popup_list{ //下拉选单1
key="pophh";
edit_width=4;
}
:edit_box{label="角度";key="txtang";edit_width=4;}
:popup_list{ //下拉选单2
key="popang";
edit_width=4;
}
}
spacer_1;
ok_cancel;
}(defun c:dia7c()
(setvar "cmdecho" 0)
(setq word_list'("平面图" "立面图""总经理室" "楼梯间"
"弹簧" "螺丝" "传真机" "翔虹信息"
"翔虹AutoCAD技术中心"
"AutoCAD 2000特训教材"
"道路" "桥梁" "捷运系统" "高速铁路" "规格表"))
(setq pophh_list '("5" "10" "20" "30" "40" "50"))
(setq popang_list '("0" "30" "45" "60" "75" "90" "-30" "-45" "-60"))
(chk_style)
(dcl_dia7c)
(prin1)
)
(defun dcl_dia7c()
(setq dcl_id (load_dialog "dia7c"))
(new_dialog "dia7c" dcl_id)
(show_list "klist" word_list)
(show_list "pophh" pophh_list)
(show_list "popang" popang_list)
(set_tile "klist" "8")
(sub_klist1 "8")
(set_tile "txthh" "10")
(set_tile "txtang" "0")
(action_tile "klist" "(sub_klist1 $value)")
(action_tile "pophh" "(sub_pophh $value)")
(action_tile "popang" "(sub_popang $value)")
(action_tile "accept" "(ok_dia7c)(done_dialog 1)")
(setq dd(start_dialog))
(if (= dd 1)
(progn
(setq inspt (getpoint "文字写入点:"))
(command "text" inspt txthh txtang wordstr)
)
)
)
(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 sub_pophh(vvs)
(set_tile "txthh" (nth (atoi vvs) pophh_list))
)
(defun sub_popang(vvs)
(set_tile "txtang" (nth (atoi vvs) popang_list))
)
(defun ok_dia7c()
(setq wordstr(strcase (get_tile "wordstr")))
(setq txthh(get_tile "txthh"))
(setq txtang (get_tile "txtang"))
)
(defun chk_style();检查字型
(setq chksty(tblsearch "style" "kk"))
(if (null chksty)
(command "_style" "kk" "细明体" "" "" "" "" "" )
)
(setq chklay(tblsearch "layer" "txt"))
(if (null chklay)
(command "_layer" "m" "txt" "c" "3" "txt" "")
)
(setvar "clayer" "txt")
(setvar "textstyle" "kk")
)
问题如下:
红色区域中,用get_tile函数获得的下拉列表框的值是字符串型,也就是txthh和txtang都是字符串类型,在绿色区域中对应的应该是整数或实数型(比如8或8.5之类)才对吧。我加载后发现上面的代码也可以运行无误,不知道是为什么?想来想去不明白!
还有个问题,上传的程序加载不一样能运行,因为我的电脑没有细明体这个字体,而且变成宋体也加载不成功,只能加载如:txt.shx,times.shx之类的字体,加载能成功,但是文字是乱码!
本帖最后由 chenlight 于 2012-10-22 11:34 编辑
因不太会使用着色,现截图出来,以下是红色区域的内容
以下是绿色区域的内容
得到的是字符格式 程序列表字库在文本框显示,要是能清空再显示会好点,还有下拉列表直接能输入数字会方便很多 学习了。。。。。
页:
[1]