You may want to change the text of one of the exit buttons for some dialog boxes.
For example, if you create a dialog box capable of destroying data, it is safer to label 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 text being assigned to 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.
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 default 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;
}
}
The new subassembly that replaces the ok_button with the new button might look like the following:
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 was not 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. For example, the following defines the Cancel button as both the Default and 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.