明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1849|回复: 8

retirement_button是什么控件呀

[复制链接]
发表于 2004-10-31 17:32:00 | 显示全部楼层 |阅读模式
在一个dcl里面看到了retirement_button控件,查找WINDOWS的帮助里面没有,谁知道是什么控件啊?和button有什么不同?
发表于 2004-10-31 17:48:00 | 显示全部楼层
这应该是一个自定义控件,看看帮助文件中控件的定义和控件的引用部分介绍
 楼主| 发表于 2004-10-31 17:52:00 | 显示全部楼层
可是vlisp的编辑窗口认识它,显示蓝色呀,多谢
发表于 2004-10-31 18:25:00 | 显示全部楼层
在base.dcl里定义
发表于 2004-10-31 18:29:00 | 显示全部楼层
它与dialog一样也是一个prototype (原态?模型?),当然显蓝色,认真看看帮助文件。
发表于 2004-10-31 18:53:00 | 显示全部楼层

For some dialog boxes, you may want to change the text of one of the exit buttons. For example, if you create a dialog box capable of destroying data, it's safer to call the button Destroy instead of OK. To do this, use the retirement_button prototype as follows:

destroy_button : retirement_button {
               label = "&Destroy";
               key = "destroy";
}

Notice the use of the ampersand (&) in the label attribute. This assigns a mnemonic to the tile. In this case the letter D is underscored in the button label and becomes the mnemonic.

Note When customizing existing button subassemblies, you should obtain the proper DCL code from your base.dcl file rather than from the manual.

Once you have defined a custom exit button, you need to embed it in a subassembly that matches the appearance and functionality of the standard clusters. The following example shows the current definition of ok_cancel_help:

ok_cancel_help : column {
             : row {
                fixed_width = true;
                alignment = centered;
                ok_button;
                : spacer { width = 2; }
                cancel_button;
                : spacer { width = 2; }
                help_button;
              }
}

Create a new subassembly that replaces the ok_button with the new button as follows:

destroy_cancel_help : column {
              : row {
                 fixed_width = true;
                 alignment = centered;
                 destroy_button;
                 : spacer { width = 2; }
                 cancel_button;
                 : spacer { width = 2; }
                 help_button;
              }
}

In the standard subassembly, the OK button is the default, but this attribute wasn't added to destroy_button. Where the dialog box's action can be destructive (or very time-consuming), it is strongly recommended to make the Cancel button the default. In this case, it functions both as the default and as the Abort button:

destroy_cancel_help : column {
              : row {
                 fixed_width = true;
                 alignment = centered;
                 destroy_button;
                 : spacer { width = 2; }
                 : cancel_button { is_default = true; }
                 : spacer { width = 2; }
                 help_button;
              }
}

Because an attribute has been changed, the original Cancel button is used as a prototype, requiring a colon in front of cancel_button.

Warning! When the Cancel button and the Default button are the same (both is_default and is_cancel are true) and you neglect to assign an action that calls done_dialog to any other button, then no other button can exit the dialog box and it will always be canceled.

 楼主| 发表于 2004-10-31 20:06:00 | 显示全部楼层
alin发表于2004-10-31 18:29:00它与dialog一样也是一个prototype (原态?模型?),当然显蓝色,认真看看帮助文件。

可以告诉我帮助文件怎么说的么?我的帮助文件里面没有呀。
发表于 2004-10-31 20:16:00 | 显示全部楼层
可以告诉我帮助文件怎么说的么?我的帮助文件里面没有呀
6楼的就是啊。你把帮助文件里的代码窜起来测试一下就知道怎么回事,实际上是利用ok_cancel_help组件自定义了一个destroy_cancel_help组件。 destroy_cancel_help : column {
: row {
fixed_width = true;
alignment = centered;
destroy_button;
: spacer { width = 2; }
: cancel_button { is_default = true; }
: spacer { width = 2; }
help_button;
}
}
destroy_button : retirement_button {
label = "&Destroy";
key = "destroy";
}
TEST: dialog {
destroy_cancel_help;
}
 楼主| 发表于 2004-10-31 21:40:00 | 显示全部楼层
本帖最后由 作者 于 2004-11-2 14:48:32 编辑
  1. //----- Standard prototype for making consistent "dialog retirement buttons".
  2. //           Used below for the predefined retirement buttons, and for user-defined
  3. //           dialogs that need retirement buttons with specialized verbs. retirement_button : button {
  4.                fixed_width         = true;
  5.                width                     = 8;
  6.                alignment = centered;
  7. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 08:38 , Processed in 0.170368 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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