adslwang 发表于 2014-2-11 22:37:59

路過大神請幫忙一下,利用DCL批量打開工具條無法實現..

本帖最后由 adslwang 于 2014-2-11 22:41 编辑

如题我附上档案......
LISP是从ZZXXQQ版主于其中一个档案延伸修改,在此谢过.....

是这样的,因为我有许多工具条,一般都是点选打开,我想利用DCL的方式可以看到原有工具条的样态....
在附加的档案中如果单独执行TR100后输入   1+2+3   就可以将工具条连续的打开三个,可是加入DCL并给
一栏输入   1+2+3输入之后确没有办法将工具条连续的打开三个,这是为什麽呢?我特别将那两栏以蓝色及
红色区别出来,请路过大神帮个忙一下,感谢.....
(defun TR100 (/ S0 S S1)
(setq A "")
(while (= A "")
   (setq A (getstring "\ 请工具列打开批号   [范例(1~10):1+6+8+10]:")) ;;採用LISP该处单独输入就不会发生问题
   (setq A ATOOL10))                                                                                  ;;该处搭配DCL就会无法开启工具条



ZZXXQQ 发表于 2014-2-11 22:38:00

(defun c:T10()
   (setvar "cmdecho" 0)
   (dcl_dia8b)
   (prin1)
)
(defun dcl_dia8b()
(if (> (setq dcl_id (load_dialog "dia8b")) 0) (progn
(if (new_dialog "dia8b" dcl_id) (progn
   (def_dia8b)
   ;;          dcl对应命令       lisp副程式子命令名
   (action_tile "kimage1"   "(addtool 1)")
   (action_tile "kimage2"   "(addtool 2)")
   (action_tile "kimage3"   "(addtool 3)")
   (action_tile "kimage4"   "(addtool 4)")
   (action_tile "kimage5"   "(addtool 5)")
   (action_tile "kimage6"   "(addtool 6)")
   (action_tile "kimage7"   "(addtool 7)")
   (action_tile "kimage8"   "(addtool 8)")
   (action_tile "kimage9"   "(addtool 9)")
   (action_tile "kimage10" "(addtool 10)")
   (action_tile "kimage20" "(setq ddtype 20)") ;;输入批量载入使用
   (action_tile "accept" "(ok_dia8b)(done_dialog 1)")
   (setq dd (start_dialog))
)
   (princ "\n无法显示对话框!")
)
(unload_dialog dcl_id)
)
(princ "\n无法加载对话框!")
)
(if (= dd 1) (draw_dia8b))
)
(defun def_dia8b()
   ;;       dcl对应命令的四个命令钮
(setq i 0)
(repeat 10
(show_sld (strcat "kimage" (itoa (setq i (1+ i)))) (strcat "AA" (itoa i)))
)
;   (setq sldkey_list '("kimage1" "kimage2" "kimage3" "kimage4" "kimage5" "kimage6" "kimage7" "kimage8" "kimage9" "kimage10"))
   ;;       dcl中的.sld对应上方命令的四个幻灯片档
;   (setq sld_list    '("AA1" "AA2" "AA3" "AA4" "AA5" "AA6" "AA7" "AA8" "AA9" "AA10"))
;   (mapcar 'show_sld sldkey_list sld_list)
)
;;dcl中的.sldw影像档转化程式
(defun show_sld (key sld)
   (setq x (dimx_tile key))
   (setq y (dimy_tile key))
   (start_image key)
   (fill_image 0 0 x y -2)
   (slide_image 0 0 x y sld)
   (end_image)
)
(defun addtool (n)
(mode_tile (strcat "kimage" (itoa n)) 1)
(setq ddtype n)
(setq ATOLL (get_tile "ATOOL10"))
(set_tile "ATOOL10" (strcat ATOOL (if (> (strlen ATOOL) 0) "+" "") (itoa n)))
)
(defun ok_dia8b() (setq ATOOL (get_tile "ATOOL10")))
(defun draw_dia8b()
(if (= (strlen ATOOL) 0)
(if (< ddtype 11)
(alert (strcat "工具列第" (itoa ddtype) "组打开"))
(TR100)
)
(progn
(setq ATOOL (read(strcat "(" (vl-string-translate "+" " " ATOOL) ")")))
(foreach s ATOOL (command "toolbar" (strcat "B" (itoa s) "项目工具条") "S"))
))
)
(defun TR100 ()
(setq ATOOL "")
(while (= ATOOL "")
    (setq ATOOL (getstring "\ 请工具列打开批号   [范例(1~10):1,6,8,10]:"));;输入如:2/6/23…..
)
(setq ATOOL (strcat ATOOL ","));;ATOOL = 1,5,6,
(initget 1)
(setq AL (+ (strlen ATOOL) 1))    ;; 1,5,6 = 5+1 =6个字母;;;;;;;;;;;;;;;;;;;
(setq N 1)
(setq S "")
(setq S0 0)
(while (/= N AL) ;(not (= N AL))    ;; 1 /= 6
   (if(= (substr ATOOL N 1) ",")   ;;取出字串的第一个字元是否为 ,
    (progn
      (setq S0(atoi S));(setq s0 (+ s0 (atoi s)))
      (setq S1 (strcat "B" s "项目工具条"))
      (command "toolbar" S1 "S") ;;批量打开工具列S=打开H=关闭
      (setq S "")
    )
   (setq S (strcat S (substr ATOOL N 1))) ;; ""1
   )
   (setq N (+ N 1))
)
)

edata 发表于 2014-2-11 23:18:33

比较明显的是(setq A ATOOL10))中变量写错了,没有10这个结尾,手机上看不太清楚。

adslwang 发表于 2014-2-12 13:35:07

ZZXXQQ 发表于 2014-2-11 22:38 static/image/common/back.gif


一直沒有意會到已經修改完成,還再執著於自給的自定義的工具條名稱,所以一直沒有實現成功,謝謝。
另外也謝謝EDATA的幫忙..

chbddzx12 发表于 2015-2-1 18:54:20

学习了~~~~~~~~
页: [1]
查看完整版本: 路過大神請幫忙一下,利用DCL批量打開工具條無法實現..