i'm trying to write a taskbar for my program, and i need to add one line of code in 2 events, OnClose and OnActivate, but my program has over 100 forms, so i'd like to do it dynamically. Is there an way to do it?
The language is Delphi 7.
i'm trying to write a taskbar for my program, and i need to add one line of code in 2 events, OnClose and OnActivate, but my program has over 100 forms, so i'd like to do it dynamically. Is there an way to do it?
The language is Delphi 7.
Copyright © 2021 Jogjafile Inc.
As TLama and David Hefferman say, inheritance is right way to do it, but sometimes pragmatism wins out over the right way. So here is a horrible Kludge that will do the job.
Create an instance of the TKludges class and pass the Application to it. For every form that it finds it will replace the events with new ones that call the original if it exists and put your extra lines in (just comments at the minute).
What makes it particularly horrible is the EVERY form will be affected, including ones you might not expect. But if you are sure...
Use at your own risk!