2.2.8 command (Repurposed Command)

This element specifies that a particular built-in command in the application is to be repurposed.

The enabled and getEnabled attributes can be specified to disable a command.

The onAction attribute allows the functionality of a command to be repurposed to run a callback function. Only commands that execute simple actions (for example, commands represented as button controls) can be repurposed using onAction.

For example, consider the following XML fragment:

 <commands>
   <command idMso="Bold" enabled="false" />
   <command idMso="Paste" onAction="MyPasteFunction" />
 </commands>

In this example, the Bold command is permanently disabled and that the callback function MyPasteFunction is called when the Paste command is invoked.

The following table summarizes the elements that are parents of this element.

Parent Elements

commands (section 2.2.9)

The following table summarizes the attributes of this element.

Attributes

Description

enabled (enabled state)

Specifies the enabled state of the control.

The getEnabled and enabled attributes are mutually exclusive. If neither attribute is specified, the control SHOULD default to being enabled.

This attribute cannot be used to enable a built-in control that would otherwise be disabled by the application.

For example, consider the following XML fragment:

 <button   id="button" label="Disabled Button" enabled="false"   />

This specifies a new button that is disabled. A permanently disabled button is not very useful, thus the enabled attribute is not commonly used.

The possible values for this attribute are defined by the XML schema boolean datatype.

getEnabled (getEnabled callback)

Specifies the name of a callback function to be called to determine the enabled state of this control.

The getEnabled and enabled attributes are mutually exclusive. If neither attribute is specified, the control SHOULD default to being enabled.

For example, consider the following XML fragment:

 <button   id="button" getEnabled="IsButtonEnabled" />

In this example, the IsButtonEnabled callback function is called when the application needs to determine the enabled state of the button.

The possible values for this attribute are defined by the ST_Delegate simple type, as specified in section 2.3.2.

idMso (built-in control identifier)

Specifies the identifier of a built-in control.

The contents of this attribute are application-defined.

For example, consider the following XML fragment:

 <control   idMso="Bold" />

This creates a clone of the control with an identifier of "Bold".

The possible values for this attribute are defined by the ST_ID simple type, as specified in section 2.3.5.

onAction (onAction callback)

Specifies the name of a callback function to be called when this control is invoked by the user.

For example, consider the following XML fragment:

 <button   id="button" label="Button"   onAction="ButtonClicked" />

This specifies a button that calls the ButtonClicked callback function when it is invoked.

The possible values for this attribute are defined by the ST_Delegate simple type, as specified in section 2.3.2.

The following XML schema fragment defines the contents of this element:

 <xsd:complexType name="CT_Command" mixed="false">
    <xsd:attributeGroup ref="AG_Action"/>
    <xsd:attributeGroup ref="AG_Enabled"/>
    <xsd:attributeGroup ref="AG_IDMso"/>
 </xsd:complexType>