Root > Reference > All Units > EEvents Unit

EEvents Unit

Previous pageReturn to chapter overviewNext page   

EurekaLog events.

 

Remarks

This unit serves event for EurekaLog. It contains event types, allows you to register (subscribe to) events, and raise events manually (if ever needed).

 

Each event is done as either method or procedure. You can use either option, there is no difference between method and procedure, so you can use whatever you want.

 

All events follows the same template. To use EurekaLog event you must declare a procedure or method with required signature (see explanation of specific events for exact code syntax). There is RegisterEventEventName procedure, which you can use to register event handler for any event. And there is reverse UnregisterEventEventName routine, which cancels event for your handler.

 

Note

Additionaly, there is also DoEventEventName procedure, which can be used to invoke event, but it's typically used by EurekaLog itself.

 

See examples below for sample code to register event handler.

 

Instead of using events from code - you can subscribe to event by using EurekaLog component. You can just drop component to form and double click on any event to create event handler - much like you do with creating event handlers for, say, FormCreate event for form, etc.

 

Tip

It's recommended to use registration from code instead of using the component.

 

For detailed description of each event - please see this index article.

 

Caution!

Any event is called from the context of exception thread, which may be not the main thread of application. Thus, it's highly recommended to avoid using any global-like data and to avoid access VCL objects. If you still need to do any of that - please use proper thread synchronization for globals and Synchronize method for VCL access.

 

Examples

The common example of using an event hander (in this example OnExceptionNotify event is used) is as following.

 

Example for function handler:

 

Code (Delphi)

unit Unit1;

...

implementation

...

procedure MyHandler(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo; var AHandled: Boolean; var ACallNextHandler: Boolean);

begin

// ... your code ...

end;

initialization

RegisterEventExceptionNotify(nil, MyHandler);

finalization

UnregisterEventExceptionNotify(nil, MyHandler); // optional, may be missed

end.

 

 

Code (Delphi)

unit Unit1;

...

type

TForm1 = class

...

procedure MyHandler(AExceptionInfo: TEurekaExceptionInfo; var AHandled: Boolean; var ACallNextHandler: Boolean);

end;

implementation

...

procedure TForm1.FormCreate(Sender: TObject);

begin

RegisterEventExceptionNotify(MyHandler);

...

end;

procedure TForm1.FormDestroy(Sender: TObject);

begin

UnregisterEventExceptionNotify(MyHandler); // mandatory, must be present

...

end;

procedure TForm1.MyHandler(AExceptionInfo: TEurekaExceptionInfo; var AHandled: Boolean; var ACallNextHandler: Boolean);

begin

// ... your code ...

end;

...

end.

 

 

See also




Send feedback... Build date: 2023-09-11
Last edited: 2023-09-11
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_unit_eevents.php