Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 18199, RWare application events

by Robert Cerny Email: Anonymous


This is a working replacement for TApplicationEvents component and an example of proper event hooking of global objects.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 5.0  to 7.0 300 downloads
Copyright: Open Source or other


Size: 4,346 bytes
Updated on Wed, 07 May 2003 02:52:08 GMT
Originally uploaded on Sat, 29 Jun 2002 05:41:01 GMT
SHA1 Hash: 41FC95E9751CE3539D9E2E80BCE81F0E0E7BB16F
MD5 Hash: 48D1B56572B0F99641DAE1407CF71EC3

    Explore the files in this upload

Description
*NEW* updated for D7
There are several problems with original ApplicationEvents:
- unit creates TMulticaster which assigns application events regardless of needs,
- Assigning events changes code flow, so CustomApplicationEvents has to duplicate all the code around it in DoXXXX method, like DoException, even if component user does not use that particular event. Even worse, if you remove the object, but forget to remove the unit from "uses" clause, the unit will still create Multicaster object, which hooks events and you again lose default handling (like DoException)
- TMulticaster holds a list of all created instances of
TCustomApplicationEvents, meaning the user will get lots of
access violations, if used on non-main form that might be
destroyed/recreated during runtime

TRWApplicationEvents (hopefully) fixes all of above and adds two
Screen events:
OnActiveControlChange and OnActiveFormChange;

Actually, it's an example of proper event hooking of global component.
The application event is hooked only if at least one of TRWApplicationEvents assigns the particular event.
IOW, if the user of TRWApplicationEvents does not create OnException event, the component does not hook Application.OnException.

If the component is destroyed, events are properly unhooked,
so you can use it on main form as well as any other form/module.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03