使用 DCL 定义对话框 
首先看一下您需要创建的对话框。 
该对话框包含以下元素: 
对话框组件在 DCL 中称为磁贴。写入对话框 DCL 文件的完整内容似乎让人不知所措。诀窍是勾勒出你想要的东西,把它分解成几个部分,然后写下每个部分。 
 
定义对话框
- 在 Visual LISP 文本编辑器窗口中打开一个新文件。
 
- 在新文件中输入以下语句:
label = "Garden Path Tile Specifications"; 
 此 DCL 语句定义对话框窗口的标题。 
  
- 通过添加以下代码来定义用于指定折线类型的单选按钮:
: boxed_radio_column {    // defines the radio button areas
  label = "Outline Polyline Type";
  : radio_button {        // defines the lightweight radio button
    label = "&Lightweight";
    key = "gp_lw";
    value = "1";
   }
: radio_button {       // defines the old-style polyline radio button
  label = "&Old-style";
  key = "gp_hw";
 }
}
 DCL 指令定义框边界,并允许您为按钮集指定标签。在边界内,您可以通过添加指令来指定所需的单选按钮。每个单选按钮都需要一个标签和一个键。键是 AutoLISP 代码可以引用按钮的名称。boxed_radio_columnradio_button 
 请注意,标记为“轻量级”的单选按钮的值为 1。如果为按钮赋值 1(字符串,而不是整数),则该按钮将成为一行按钮中的默认选项。换句话说,当您首次显示对话框时,将选择此按钮。另请注意,在 DCL 文件中,双斜杠字符(而不是 AutoLISP 中的分号)表示注释。 
  
- 通过添加以下代码来定义用于选择实体创建样式的单选列:
: boxed_radio_column {     // defines the radio button areas
  label = "Tile Creation Method";
  : radio_button {         // defines the ActiveX radio button
    label = "&ActiveX Automation";
    key = "gp_actx";
    value = "1";
   }
: radio_button {          // defines the (entmake) radio button
  label = "&Entmake";
  key = "gp_emake";
 }
: radio_button {          // defines the (command) radio button
  label = "&Command";
  key = "gp_cmd";
 }
}
  
- 添加以下代码以定义允许用户输入指定磁贴大小和间距的数字的编辑框磁贴:
: edit_box {      // defines the Radius of Tile edit box
  label = "&Radius of tile";
  key = "gp_trad";
  edit_width = 6;
}
: edit_box {      // defines the Spacing Between Tiles edit box
  label = "S&pacing between tiles";
  key = "gp_spac";
  edit_width = 6;
}
 请注意,此定义不为编辑框设置任何初始值。您将为 AutoLISP 程序中的每个编辑框设置缺省值。 
  
- 为“确定”和“取消”按钮添加以下代码:
: row {          // defines the OK/Cancel button row
  : spacer { width = 1; }
  : button {    // defines the OK button
    label = "OK";
    is_default = true;
    key = "accept";
    width = 8;
    fixed_width = true;
  }
  : button {    // defines the Cancel button
    label = "Cancel";
    is_cancel = true;
    key = "cancel";
    width = 8;
    fixed_width = true;
  }
  : spacer { width = 1;}
}
 两个按钮都在一行中定义,因此它们水平排列。 
  
- 滚动到文本编辑器窗口的开头,并将以下语句作为 DCL 中的第一行插入:
gp_mainDialog : dialog {
  
- 该指令需要右大括号,因此滚动到文件末尾并将大括号添加为 DCL 代码的最后一行:dialog
} 
  
 
 
    
 |