Article number: KB000027
Event calling is supported 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. A handler is to be described for the called event.
Executing the example requires a form. 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", 3, Null);
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: