I get an error :
[DCC Error] Unit_TProcessClass.pas(334): E2010 Incompatible Type: 'TBitmap' and 'tagBITMAP'
the class is defined as
TMyClass = Class
private
MyBMP : TBitmap;
property aBMP : TBitmap read MyBMP write MyBMP;
and the code goes like
processABitmap(aMyClass.aBMP) ; -> here is the compile error !!!
The problem is that there are two types named TBitmap
in the VCL. One defined in the Windows
unit and one defined in Graphics
unit. Clearly you are passing Windows.TBitmap
to a function expecting Graphics.TBitmap
, or vice versa.
You almost certainly don't want to have anything to do with Windows.TBitmap
. So the solution is to make sure that all of your units list the Graphics
unit after the Windows
unit in the uses clause. This will have the effect of hiding Windows.TBitmap
.
My psychic debugging suggests that the unit in which TMyClass
is declared either does not list Graphics
at all in its uses
clause, or it lists Graphics
before Windows
.
Finally, how would you go about working out something like this yourself? Well, try pressing CTRL+click on the TBitmap
referenced in TMyClass
. I'm confident that they will take you to the TBitmap
declared in Windows
. That should be enough for you to work out that it's not the type that you meant when you wrote TBitmap
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With