您可能希望更改某些对话框的某个退出按钮的文本。 例如,如果创建能够销毁数据的对话框,则标记“销毁”按钮而不是“确定”会更安全。为此,请按如下方式使用原型:retirement_button destroy_button : retirement_button { label = "&Destroy"; key = "destroy"; } 请注意在分配给标签属性的文本中使用了与号 (&)。这会为磁贴分配一个助记符。在这种情况下,字母 D 在按钮标签中带有下划线并成为助记符。 注意:自定义现有按钮部件时,应从base.dcl文件中获取正确的 DCL 代码。
定义自定义退出按钮后,需要将其嵌入到与标准集群的外观和功能匹配的子装配体中。以下示例显示了以下项的默认定义: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; } } 替换为新按钮的新子装配体可能如下所示:ok_button destroy_cancel_help : column { : row { fixed_width = true; alignment = centered; destroy_button; : spacer { width = 2; } cancel_button; : spacer { width = 2; } help_button; } } 在标准子装配体中,“确定”(OK) 按钮是缺省按钮,但未添加此属性。如果对话框的操作可能具有破坏性(或非常耗时),强烈建议将“取消”按钮设置为默认值。例如,下面将“取消”按钮定义为“默认”和“中止”按钮:destroy_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; } } 由于属性已更改,因此原始的“取消”按钮用作原型,前面需要冒号。cancel_button 注意:如果“取消”按钮和“默认”按钮相同(两者相同),并且您忽略了分配调用任何其他按钮的操作,则没有其他按钮可以退出对话框,并且该按钮将始终被取消。is_defaultis_canceltruedone_dialog
|
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )
GMT+8, 2024-6-10 20:25
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.