An Example of a Control Definition File

The following example shows the handling of an object whose value changes at each MouseUp event. The value is in the Value property of the object. The MouseUp event handler has Button, Clicks, Delta, X, and Y event arguments.

The Record element describes the conversion of the MouseUp event to a SetValue command. The Replay element defines the SetValue command as setting the value of the object to the recorded Value and displaying the position of the mouse pointer for debugging purposes:

<?xml version="1.0" encoding="UTF-8"?>
<Customization>
    <Record>
        <Events>
            <Event name="MouseUp" enabled="true">
                <RecordedCommand name="SetValue">
                    <Parameter>
                        Sender.Value
                    </Parameter>
                    <Parameter lang="C#">
                        String xy;
                        xy = EventArgs.X + ";" + EventArgs.Y;
                        Parameter = xy;
                    </Parameter>
                </RecordedCommand>
            </Event>
        </Events>
    </Record>
    <Replay>
        <Methods>
            <Method name="SetValue">
                <Parameters>
                    <Parameter type="int" name="Value"/>
                    <Parameter type="String" name="MousePosition"/>
                </Parameters>
                <MethodBody>
                    RtObject.Value = Value;
                    System.Windows.Forms.MessageBox.Show(MousePosition, "Mouse Position at Record Time");
                </MethodBody>
            </Method>
        </Methods>
    </Replay>
</Customization>