明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1467|回复: 2

[基础] 对话框添加“取消”功能!

[复制链接]
发表于 2009-11-26 15:11 | 显示全部楼层 |阅读模式

如何为对话框添加取消按钮,我这里按了“取消”跟按了“确定”是一样的效果!怎么修改!

或者在以下红色部分,改为提示2次,如果2次后还是NIL则,退出对话框!

(DEFUN C:pma()  (SETQ DCL_ID (LOAD_DIALOG "aaa")) 
 (NEW_DIALOG "aaa" DCL_ID)
;(SET_TILE "pma_pn" "0")
(SET_TILE "pma_pname" printername)
(SET_TILE "pma_ptype" paper)

 (ACTION_TILE "accept" "(S_RECT)(DONE_DIALOG)") 

 
 (START_DIALOG)
 (UNLOAD_DIALOG dcl_id) 

 (PRINC))


(DEFUN S_RECT()
(setq fff (atoi (get_tile "pma_type")))
(if (>= fff 0)
(progn
(cond ((= 0 fff)
           ;(setq dyfs (get_tile "pma_pn"))
           (setq dyfs (itoa (+ (atoi (get_tile "pma_pn")) 1)))
           (setq xmdh (get_tile "project_name"))
          
           (if (= xmdh "")
           (progn
            (alert "请输入项目代号")
           (c:pma)
      
 
           );;;end progn
           );;;end if
          
          
           (setq lx "白图")
           (vl-load-com)
          
           (foreach n gmlb (VL-FILE-COPY (STRCAT pltpath n) (STRCAT "\\\\192.168.1.16\\tempplt\\" n)))  ;;\\\\192.168.1.16\\tempplt\\
          (foreach n gmlb (vl-file-delete (strcat pltpath n)))
           )
            ((= 1 fff)
            (setq dyfs (itoa (+ (atoi (get_tile "pma_pn")) 1)))
            (setq xmdh (get_tile "project_name"))
           
            (if (= xmdh "")
           (progn
           (alert "请输入项目代号")
           (c:pma)
           );;;end progn
           );;;end if
           
            (setq lx "硫酸纸")
           (vl-load-com)
          
          (foreach n gmlb (vl-file-copy (strcat pltpath n) (strcat "\\\\192.168.1.16\\tempplt\\" n)))
          (foreach n gmlb (vl-file-delete (strcat pltpath n)))
            )
    )))        


 )
(c:pma)

DCL如下:

dcl_settings : default_dcl_settings { audit_level = 3; }

aaa : dialog {
    label = "PMA系统";
    : boxed_column {
        label = "打印信息";
        mnemonic = "?";
        : edit_box {
            label = "项目代号";
            key = "project_name";
            mnemonic = "????钾矑?矑?= ";
        }
        : popup_list {
            label = "打印张数";
            key = "pma_pn";
            mnemonic = "?";
            list = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10";
        }
        : popup_list {
            label = "纸张类型";
            value = "jmj";
            key = "pma_type";
            mnemonic = "?";
            list = "白图\n硫酸纸";
        }
        : edit_box {
            label = "打印机名";
            key = "pma_pname";
            mnemonic = "?";
            is_enabled = false;
            width = 30;
        }
        : edit_box {
            label = "图纸大小";
            key = "pma_ptype";
            mnemonic = "?联鯀?钾矑粼矒?ē ";
            is_enabled = false;
        }
    }
    ok_cancel;
}

发表于 2009-11-26 18:51 | 显示全部楼层
替你做了一下
  1. (DEFUN C:pma (/ fff xmdh dyfs DCL_ID)
  2.   (DEFUN do_ok ()
  3.     (setq fff  (atoi (get_tile "pma_type"))
  4.    xmdh (get_tile "project_name")
  5.    dyfs (itoa (+ (atoi (get_tile "pma_pn")) 1))
  6.     )
  7.     (if (= xmdh "")
  8.       (alert "请输入项目代号")
  9.       (done_dialog 1)
  10.     )
  11.   )
  12.   (DEFUN dlg ()
  13.     (SETQ DCL_ID (LOAD_DIALOG "aaa"))
  14.     (NEW_DIALOG "aaa" DCL_ID)
  15.     (SET_TILE "pma_pname" printername)
  16.     (SET_TILE "pma_ptype" paper)
  17.     (ACTION_TILE "accept" "(do_ok)")
  18.     (action_tile "cancel" "(done_dialog 0)")
  19.    
  20.     (START_DIALOG)
  21.   )
  22.   (vl-load-com)
  23.   (setq printername "" paper "");这两个参数不知你给什么值,这里先给空值
  24.   
  25.   (if (/= (dlg) 0)
  26.     (S_RECT)
  27.   )
  28.   
  29.   (UNLOAD_DIALOG dcl_id)
  30.   (PRINC)
  31. )
  32. (DEFUN S_RECT (/ lx n gmlb pltpath)
  33.   (if (>= fff 0)
  34.     (progn
  35.       (cond ((= 0 fff)
  36.       (setq lx "白图")
  37.      )
  38.      ((= 1 fff)
  39.       (setq lx "硫酸纸")
  40.      )
  41.       )
  42.       (foreach n gmlb
  43. (vl-file-copy
  44.    (strcat pltpath n)
  45.    (strcat "\\\\192.168.1.16\\tempplt\" n)
  46. )
  47.       )
  48.       (foreach n gmlb (vl-file-delete (strcat pltpath n)))
  49.     )
  50.   )
  51. )
 楼主| 发表于 2009-12-1 10:42 | 显示全部楼层
实在找不出为什么说参数类型错误,请再帮忙看看!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-17 16:58 , Processed in 0.208947 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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