Event Handler Description Events Handling Description (custom control)
How should a new event handler is defined if it does not already belong to the base class? Let's look at this using the "Tfrxeditcontrol" common control as an example:
How should a new event handler be defined if it does not belong to the base class? Let's take a look at using the "Tfrxeditcontrol" control as an example:
Tfrxeditcontrol = Class (Tfrxdialogcontrol)
Private
Fedit:tedit;
{New Event}
Fonchange:tfrxnotifyevent; Defines the event, registration type.
Procedure Doonchange (Sender:tobject); Event-handling procedures
...
Public
Constructor Create (aowner:tcomponent); Override
...
Published
{New Event}
Property Onchange:tfrxnotifyevent read Fonchange write Fonchange; Defining events
...
End
Constructor Tfrxeditcontrol.create (aowner:tcomponent);
Begin
...
{Connect Our Handler}
Fedit.onchange: = Doonchange; Associating an event in Create (associating an event of a Tedit control to its own process)
Initcontrol (Fedit);
...
End
Procedure Tfrxeditcontrol.doonchange (Sender:tobject);
Begin
{Call event handler}
If report <> Nil Then
Report.donotifyevent (Sender, Fonchange); Handling events (invoking scripts in the report in the process)
End
It is important to note that the event handler in Fastreport are a procedure defined in the report script. The tfrxnotifyevent type is declared as string[63] and in Fastreport the link to the handler are a String containing its NA Me. This was unlike the Delphi tnotifyevent type, in which it was a method address.
It is important to note that an event handler is a procedure that is defined in a report script. The tfrxnotifyevent type is declared as string[63], and the event-handling process linked in Fastreport is a string (containing its name). This is not like the Tnotifyevent type in Delphi, it is the address of a method.
Translation Event Handler Description Events Handling Description