Jump to content
alogrep

Delphi 11.2 and Tpngobject.

Recommended Posts

Hi all.

I have installed version 11.2 and now I get error at runtime with buttons that have a pngobject.

In the Form the image shows. In the object inspector it does show Tpngobject, and a click on it shows the miniature image. but at runtime it shows that the picture graphic is not assigned. 

Perhaps there is a new Pngcomponents.dpk  required for version 11.2> 

Uwe Raabe. any ideas?

Share this post


Link to post

TPngObject is outdated since D2009 and replaced with TPngImage. PngComponents allows to register TPngObject as a class directly derived from TPngImage when RegisterOldPngFormat is defined. There are other libraries that do something similar and it is mandatory to stick to only one of these. Otherwise strange things can happen.

Share this post


Link to post

François Piette i get AV b/c the image.picture..graphic is Null. Yet at design yime the image shows ok.

 

Share this post


Link to post

Uwe Raa, hi.

I use the  PngComponents you suggested to me. the Alexandria package. all worked ok with version 11.15, after I installed ver 11.2 (Delphi) it broke.

Share this post


Link to post

The (TPNGObject) reference in the Object Inspector implies that the DFM contains an old TPNGObject instance. This can happen when that DFM was created in a Delphi version before D2009 or with the old PngObjects library. Since Delphi 2009 the corresponding graphic class is named TPngImage.

 

The PngComponents packages are by default compiled with RegisterOldPngFormat defined. Unless you define the same in your application it cannot recognize the TPNGObject instance in the DFM.

 

To convert from TPNGObject to TPngImage simply open the image in the IDE designer as you already did. Then save the image to disk and load it again. After that the Object Inspector should have (TPngImage) and your application will work without the define mentioned above.

Share this post


Link to post

Thanks again Uwe.

(I amd converting a very large project and I need a couple of months more of compatibility betweenXE and legacy Delphi)
When I put RegisterOldPngFormat in Conditional defines of the App and I build  I get this error:
[dcc32 Fatal Error] POS.dpr(1): F1027 Unit not found: 'System' or binary equivalents (.dcu)
 
The .dcu created by pngcomponents package are in C:\hmxe\png\PackagesAlexandria\Win32\Release.
I tried to add this directory to the search path, but I get the  same error.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×