1

I have my custom Delphi component used in many my programs.

After code upgrade I changed my custom event TUvValidateEvent type (parameter count and types), however Delphi (I use XE1 or simply XE) compiler compiles my programs and do not warn me about dependencies I need to change.

How to automatically check this to be able to fix it, without finding all event uses by hand?

Sample:

Component.pas
//OLD
  TUvValidateEvent = procedure(ErrMsg: UnicodeString) of object; 

//NEW
  TUvValidateEvent = procedure(Sender: TObject; Data: TUvValues; var ErrMsg: UnicodeString) of object;

Code.pas

procedure TMyForm.OnUvValidate(ErrMsg: UnicodeString); //Need to find this automatically.

P.S. Changing event property name is fix I currently use, however, I would prefer not to.

4
  • Do you mean events that are assigned via the object inspector? Commented Dec 14, 2013 at 11:44
  • Yes, I use Object inspector for 99.9% of my events. And the rest 0.1% I know and remember well enough to check by hand. Commented Dec 14, 2013 at 11:48
  • 1
    Then you could try DFMCheck. I believe "Open/Close all forms" should help you. Commented Dec 14, 2013 at 12:17
  • 1
    @UliGerhardt That's a good suggestion when the new event has a different name, but Delphi only checks event handler compatibility when saving, not when closing an unmodified form, so if the event still exists (even with a different type), opening and immediately closing forms won't help. Opening all forms and clicking the Save button for each one of them, however, might. Even though the forms will still be unmodified. Commented Dec 14, 2013 at 12:26

1 Answer 1

2

The compiler cannot find this form of type mis-match because the compiler is not involved. The properties that are specified in the .dfm file are only resolved at run time. And when they are resolved, there is no type checking at run time either.

So, you'll need to hunt these down yourself. You can do this with any decent file search tool. For instance I would use grep to do this. Or you could use the Delphi IDE find in files tool. Or the find in files search in your favourite text editor.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.