明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3330|回复: 3

如何实现对话框的嵌套[求助]

[复制链接]
发表于 2009-4-29 18:40:00 | 显示全部楼层 |阅读模式

 (defun initimg( img_key slide / x1 y1)                // 定义初始化函数,有两个全局变量img_key和slide
    (setq x1 (dimx_tile img_key))                     //获取图像按钮的长度
    (setq y1 (dimy_tile img_key))                    //获取图像按钮的宽度
    (start_image img_key)//开始图像控件的生成
    
    (slide_image -3 -30 x1 y1 slide)                     //在激活对话框图像控件上显示一个幻灯片
    (end_image)                                       //结束图像处理函数

  )

(defun img (/ id )
  (setq id (load_dialog "e:\\lisp\\zijide"))  //装载对话框文件
  (if (< id 0) (exit))   //如文件不存在,退出
  (if (not (new_dialog "jingujian" id)) (exit)) //对话框文件中名称不存在,退出
  (initimg "screw_0" "e:\\lisp\\GBT799-1988")  //调用初始化函数 screw_0为图像按钮key,e:\\autolisp study\\circ为幻灯片
  (initimg "screw_1" "e:\\lisp\\GBT6181-1986")
  (initimg "screw_2" "e:\\lisp\\GBT9458-1988")
  (initimg "screw_3" "e:\\lisp\\GBT9458-1989")
  (initimg "screw_4" "e:\\lisp\\JBZQ4321-1986")
  (initimg "screw_5" "e:\\lisp\\GBT9459-1988")
  (setq what_value 4)
 
  (action_tile "screw_0" "(mn01 id)")           //按GBT799-1988图像按钮,显示其子对话框,id为传递                                                   参数,必须 保证在new_dialog后
  (action_tile "screw_1" "(mn02 id)")
  (action_tile "screw_2" "(mn03 id)")
  (action_tile "screw_3" "(mn04 id)")
  (action_tile "screw_4" "(mn05 id)")
  (action_tile "screw_5" "(mn06 id)")
   (action_tile "accept" "(done_dialog 1)")//设置变量
  (action_tile "cancel" "(done_dialog 0)")
 
  (setq what_value (start_dialog))//激活对话框
 
 
    (princ)
  
  (unload_dialog id) //卸载对话框
 (princ)
  )
(defun mn01 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_dijiao01" id)) (exit))
         (setq d 0 l 0 )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (set_tile "s_l" (rtos Y 2 2))
       
         (action_tile "accept" "(getdata1)(done_dialog 2)")
         (action_tile "cancel" "(done_dialog 3)")
         (setq what_next (start_dialog))
        
        
              
      )
(defun mn02 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_GBT6181_1986" id)) (exit))
         (setq m 0  )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (action_tile "accept" "(getdata1)(done_dialog 4)")
         (action_tile "cancel" "(done_dialog 5)")
         (setq what_next (start_dialog))
        
        
              
      )
(defun mn03 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_GBT9458-1988" id)) (exit))
         (setq m 0  )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (action_tile "accept" "(getdata1)(done_dialog 6)")
         (action_tile "cancel" "(done_dialog 7)")
         (setq what_next (start_dialog))
        
        
              
      )
(defun mn04 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_dijiao02" id)) (exit))
         (setq m 0  )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (action_tile "accept" "(getdata1)(done_dialog 8)")
         (action_tile "cancel" "(done_dialog 9)")
         (setq what_next (start_dialog))
        
        
              
      )
(defun mn05 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_GBT9459-1988" id)) (exit))
         (setq m 0  )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (action_tile "accept" "(getdata1)(done_dialog 10)")
         (action_tile "cancel" "(done_dialog 11)")
         (setq what_next (start_dialog))
        
        
              
      )
(defun mn06 ( id)  //显示子circ子对话框  draw_circ是qiantao_main对话框文件中子对话框的名称

       (if (not (new_dialog "draw_JBZQ4321-1986" id)) (exit))
         (setq m 0  )//设置编辑框初值变量
  (set_tile "s_d" (rtos X 2 2))//设置初值 set_tile是设置关键字key控件的值,rtos将数转换为string 2表示十进制 2表示小数点后两位
         (action_tile "accept" "(getdata1)(done_dialog 12)")
         (action_tile "cancel" "(done_dialog 13)")
         (setq what_next (start_dialog))
        
        
              
      )
         

jingujian:dialog{
   label="紧固件类型的选择";
  :row{
       :boxed_column{
          label="选择类型";
       :row{
   :image_button{//图像按钮0
   
    color=-2;width=30;aspect_ratio=1;key="screw_0";
    }
   :image_button{//图像按钮1
    color=-2;width=30;aspect_ratio=1;key="screw_1";
    }
    :image_button{//图像按钮2
    color=-2;width=30;aspect_ratio=1;key="screw_2";
    }
             }
       :row{
   :image_button{//图像按钮3
    color=-2;width=30;aspect_ratio=1;key="screw_3";
    }
   :image_button{//图像按钮4
    color=-2;width=30;aspect_ratio=1;key="screw_4";
    }
            
   :image_button{//图像按钮5
    color=-2;width=30;aspect_ratio=1;key="screw_5";
    }
          }
          }
      
        }
 :row{//继续和退出按钮
   spacer_1;
   :button{
   label="继续";key="accept";is_default=true;fixed_width=true;
      }
   :button{
   label="退出";key="cancel";fixed_width=true;
      }
   spacer_1;
  
 }
}

 draw_U:dialog{//子对话框
          label="确定U型螺栓参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=30;aspect_ratio=0.8;key="id_img";}//图像
               :list_box{label="管子外径&D0";key="s_d";edit_width=5;height=8;
               list="14\n18\n22\n25\n33\n38\n42\n45\n48\n51\n57\n60\n76\n83\n89\n102\n108\n114\n133\n140\n159\n165\n219\n";
               fixed_width=true;}//大径列表
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=10;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=10;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }           
        
      }
draw_dijiao01:dialog{//子对话框
          label="确定地脚螺栓的参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=22;aspect_ratio=0.5;key="id_img";}//图像
               :list_box{label="&d";key="s_d";edit_width=5;height=8;
               list="M6\nM8\nM10\nM3\nM12\nM16\nM20\nM24\nM30\nM36\nM42\nM48\n";
               fixed_width=true;}//大径列表
               :list_box{label="公称长度&l";key="s_l";edit_width=5;height=8;
               list="400\n500\n630\n800\n1000\n1250\n1500\n";
               fixed_width=true;}//长度列表
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=8;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=8;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }           
        
      }
  
       draw_GBT9458_1988:dialog{//子对话框
          label="确定螺母的参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=22;aspect_ratio=0.5;key="id_img";}//图像
               :list_box{label="螺纹规格&m";key="s_d";edit_width=5;height=8;
               list="M5\nM6\nM8\nM10\nM12\nM14\nM16\nM18\nM20\nM22\nM24\nM27\nM30\nM33\nM36\n";
               fixed_width=true;}//大径列表
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=8;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=8;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }
        }
        draw_GBT6181_1986:dialog{//子对话框
          label="确定螺母的参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=22;aspect_ratio=0.5;key="id_img";}//图像
               :list_box{label="螺纹规格&d";key="s_d";edit_width=5;height=8;
               list="M5\nM6\nM8\nM10\nM12\nM14\nM16\nM18\nM20\nM22\nM24\nM27\nM30\nM33\nM36\n";
               fixed_width=true;}//大径列表
             
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=8;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=8;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }           
        
      }
      draw_GBT9459_1988:dialog{//子对话框
          label="确定螺母的参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=22;aspect_ratio=0.5;key="id_img";}//图像
               :list_box{label="螺钉大径&d";key="s_d";edit_width=5;height=8;
               list="M5\nM6\nM8\nM10\nM12\nM14\nM16\nM18\nM20\nM22\nM24\nM27\nM30\nM33\nM36\n";
               fixed_width=true;}//大径列表
              
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=8;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=8;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }           
        
      }
      draw_dijiao02:dialog{//子对话框
          label="确定地脚螺栓的参数";
         :row{//第一行:1个图像和两个列表
               :image{color=-2;width=22;aspect_ratio=0.5;key="id_img";}//图像
               :list_box{label="螺钉大径&d";key="s_d";edit_width=5;height=8;
               list="M1.6\nM2\nM2.5\nM3\nM4\nM5\nM6\nM8\nM10\nM12\nM14\nM16\nM20";
               fixed_width=true;}//大径列表
               :list_box{label="螺钉长度&l";key="s_l";edit_width=5;height=8;
               list="2\n2.5\n3\n4\n5\n6\n8\n10\n12\n(14)\n16\n20\n25\n30\n35\n40\n45\n50\n";
               fixed_width=true;}//长度列表
             }//第一行结束
         :row{//第二行,有两列
             :column{
                     :boxed_column{label="定位点";
                         :edit_box{label="定位点&x坐标";key="p_x";edit_box=8;value="150";}
                         :edit_box{label="定位点&y坐标";key="p_y";edit_box=8;value="100";}
                         :button{label="光标拾取<";key="p_p";}
                                  }
                    
                         ok_cancel;
                    }
            
        }           
        
      }

谢谢了

发表于 2009-4-30 18:45:00 | 显示全部楼层
游客,本帖隐藏的内容需要发帖数高于 5 才可浏览,你当前发帖数只有 0
发表于 2014-5-17 15:47:31 | 显示全部楼层
这是我正需要看的。
发表于 2015-5-16 17:43:53 | 显示全部楼层
感谢前辈的分享。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-21 22:09 , Processed in 0.222789 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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