2

I'm trying to write a class in Delphi 2007 that uses a ActiveX library. The class will catch an event that the ActiveX library has to expose its own event that adds some information to the ActiveX library's event.

The bottom line is that when I assign my own procedure to the ActiveX library's event that I want to use, I get an error:

E2009 Incompatible types: 'Parameter lists differ'

I'm certain the parameter lists are the same (same number of parameters and same types) so I'm thinking I'm going about it the wrong way.

Any suggestions or can someone post some sample code of what I'm trying to do?

1
  • You're much more likely to get a relevant response if you edit your question to include the parameter list. There may be a specific parameter type that is tricky. Commented Jan 12, 2009 at 5:48

2 Answers 2

5

The first thing to check is that the thing you're trying to assign to the event property is a method. It needs to be a procedure or function that belongs to a class; it can't be a standalone subroutine.

Next, note that merely confirming that the names of the types match isn't enough. Delphi allows redefining an identifier, so the type name you see in one unit isn't necessarily referring to the same thing when you see the same identifier in another unit. The meaning can even change in the middle of a unit. For example:

unit Example;

interface

uses Windows;

var
  foo: TBitmap;

implementation

uses Graphics;

var
  bar: TBitmap;

end.

The foo variable has type Windows.TBitmap, a record type, whereas bar has type Graphics.TBitmap, a class type.

You can let the IDE help you diagnose this: Ctrl+click on the identifier names and let the IDE take you to their declarations. Do they take you to the same places? If not, then you can qualify the type names with the unit names. For example, we could change the bar declaration above to this:

var
  bar: Windows.TBitmap;

Now it will have the same type as foo. Check for the same sort of thing in your event-handler declaration.

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

Comments

1

I used gabr's advice with the Ctrl+click and discovered that one of the parameters was a constant which I did not realize. I changed the second variable to a const and it worked fine. Thanks.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.