DebugObject Command

Purpose

Starts debugging of the specified development environment object.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify the following value in this property:

Value type Description
IMetabaseObjectDescriptor Description of the object that needs to be debugged.

Application Features

The option is supported only for forms, units, and assemblies. Calling the command starts a separate process where the selected object is executed.

The command does not open the specified object in development environment. If it is required to debug an object in development environment, open the object for edit using the Object.Edit command.

Example

Executing the example requires a form, buttons named Button1 and Button2 on the form, and the EditBox component named EditBox1. The EditBox1 component is used to indicate identifier of the object to be debugged. The Button1 button opens the object for edit in development environment. The Button2 button starts object debugging. See below full code of the form.

Class TestForm: Form
    Button1: Button;
    Button2: Button;
    EditBox1: EditBox;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        EditInDevEnv(EditBox1.Text);
    End Sub Button1OnClick;

    Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        DebugInDevEnv(EditBox1.Text);
    End Sub Button2OnClick;

    Sub EditInDevEnv(Id: String);
    Var
        Mb: IMetabase;
        ObjDes: IMetabaseObjectDescriptor;
        Target: IUiCommandTarget;
    Begin
        MB := MetabaseClass.Active;
        ObjDes := MB.ItemById(Id);
        Target := WinApplication.Instance.GetObjectTarget(ObjDes);
        Target.Execute("Object.Edit"Null);
    End Sub EditInDevEnv;
    
    Sub DebugInDevEnv(Id: String);
    Var
        Mb: IMetabase;
        ObjDes: IMetabaseObjectDescriptor;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
    Begin
        MB := MetabaseClass.Active;
        ObjDes := MB.ItemById(Id);
        Target := WinApplication.Instance.GetPluginTarget("DevEnv");
        Context := Target.CreateExecutionContext;
        Context.Data := ObjDes;
        Target.Execute("DebugObject", Context);
    End Sub DebugInDevEnv;

End Class TestForm;

After the form is started, specify identifier of the object to be debugged in EditBox1. Clicking the Button1 button opens the specified object in development environment. It is possible to set breakpoints, if required. Clicking the Button2 button starts object debugging. Execution process is paused on reaching a breakpoint. Corresponding string is highlighted in macro window.

See also:

IUiCommandTarget.Execute