CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoLISP 开发指南

关于 DCL 文件 (DCL) 中的语法和注释

2023-1-6 10:35| 发布者: admin| 查看: 760| 评论: 0|来自: AutoCAD

摘要: 对话框控制语言(DCL)文件是定义对话框及其元素的纯ASCII文件。

对话框控制语言(DCL)文件是定义对话框及其元素的纯ASCII文件。

对话框中的元素(如按钮和编辑框)称为磁贴。每个磁贴的大小和功能由磁贴的属性控制。对话框的大小及其部件的布局是自动设置的,只需最少的定位信息。

对话框定义从使用对话框磁贴开始。必须使用 DCL 文件中的每个对话框定义作为唯一名称的前缀;此名称用于从将显示对话框的 AutoLISP 程序中引用该对话框。对话框磁贴的标签属性可用于设置将显示在对话框标题栏中的文本。

下面是具有该名称的对话框定义的示例。本示例为对话框指定一个标题,并显示一个“确定”按钮。minimaldcl

minimaldcl : dialog
{
  label="Minimal Example";
  ok_only;
}
注意:对话框定义必须至少具有“取消”或“确定”按钮才能成为有效的对话框。

定义基本对话框后,可以向其添加磁贴,这些磁贴表示向用户提供信息或允许用户启动操作的控件。上一示例中的磁贴是带有标签“确定”的按钮的预定义磁贴定义。磁贴的外观和回调操作是使用属性和属性值配对定义的。下图显示了标题为“花园路径磁贴规范”的 DCL 文件中定义的对话框示例。ok_only

下面显示了包含对话框及其磁贴的 DCL 文件的内容,以及“花园路径磁贴规范”对话框的属性:

gp_mainDialog : dialog {
  label = "Garden Path Tile Specifications"; 
  : 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";
    }
  }

  : 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 = "&Spacing between tiles";
    key = "gp_spac";
    edit_width = 6;
  }
  : 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 文件中的注释。在 // 和行尾之间出现的任何内容都将被忽略。DCL 还允许 C 语言样式注释。这些都有形式。开始 /* 和结束 */ 可以在单独的行上。/* comment text */


路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 13:17

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部