In this article:

Description

Example

Manual Generation of Events

Article number: KB000027

Description

Event calling is provided by the class that represents event parameters and the class that calls the event. To call an event manually, first, create a class implementing attributes of this event and then call the event. Note that a handler should be described for the called event.

Example

Executing the example requires a form. The OnCommand event handler is described for the form. This event handler contains code required to execute the Square command.

Sub UserProc;
Var
    Argument: CommandEventArgs;
Begin
    Argument := New CommandEventArgs.Create("Square"3Null);
    Self.OnCommand(Self, Argument);
    Debug.WriteLine(Argument.Result);
End Sub UserProc;

After executing the UserProc procedure, the OnCommand event is generated for the current form. The Square command is passed as parameter, command argument is 3. The result of command execution is displayed in the development environment console.

See also:

Developers Knowledge Base