Jump to content
alogrep

Use old glyph with tpngobject in 10.4?

Recommended Posts

Hi

I have some legacy units with lots of glyph loaded with tpngoject. In my old Delphi the images are show well.

In 10.4, they are simply ignored, not shown. If I inspect the DFM loaded in 10.4 the DATA section of the glyph is not present.

Is there any way to make those units in 10.4  easier (or faster) than reload the images 1 by 1? ( I would also like to preserve the original unit to be used with the older version).

Thanks.

Share this post


Link to post

Than you Uwe. How do I install it?

I dowloaded PackagesSydney and trying to build PngComponentsDesign I get a list of errores Tpngimagelist .... not found.

If I try to build PngComponents I get the error "...source\PngSpeedButton not found" not found.

Share this post


Link to post

Thanks Uwe. But still cannot have the glyph png image shown.
I built and installed ok PngComponentsDesign.dpk (it shows in install packages. see attached image).
I built PngComponents.dpk.
But a form with components using a png image does not show the image (in my older delphi they show ok).
Any hint as to what else should I do?

s1.jpg

Share this post


Link to post

Sorry, it workds fine!. I think the error was that I had put in the library

   pngcomponents\PngObject\

(the newly installed package). I removed it and all is ok. Thank you very much

Share this post


Link to post

Indeed, the PngObject contains the files needed for versions below Delphi 2009, while since then these units are part of the Delphi standard libraries and can must be omitted.

Share this post


Link to post

Hello Uwe. I am in trouble again. I left my project for a couple of months, and now again have the same problem: The design components show in insstalled packages, but the unit with tpngobject  images do now show the image.

I uninstalled the package., I re-installed PngComponentsDesign.dpk from the sydney folder. I also re-named  pngcomponents\pngobject to make sure it does not interfere in any way. But the (content of the) images are not  not shown.

Share this post


Link to post

Hi Guys
Greeting.

 

I am trying to install https://github.com/UweRaabe/PngComponents/releases/tag/V1.9.0   with Delphi 10.4.2 Sydney. And I open PackagesSydney folder and install with "PngComponents".

 

When I complie with win32, I get the below errors:
image.thumb.png.f69a3fd3d71b76273737566789c53f41.png

It seems the PngObject is too old for 10.4.2. I am using default settings, but how can I install it? From the folders of "PngComponents", seems it do support 10.4. But actaully, it can not work.

I remember PngObject worked fine in Delphi2010. so is there any suggestion? 

thank you.

 

 

 

 

Share this post


Link to post

pngimage.pas should never be compiled in 10.4.2. It is not even part of PngComponents as it already exists as Vcl.Imaging.pngimage.dcu in the Delphi library path. You should delete that pngimage.pas and probably pnglang.pas, too.

  • Like 1

Share this post


Link to post

I was bit by this once when trying to swap the GetIt version with the github version. I switched back to the GetIt version.

Share this post


Link to post
On 8/30/2024 at 9:03 PM, Uwe Raabe said:

pngimage.pas should never be compiled in 10.4.2. It is not even part of PngComponents as it already exists as Vcl.Imaging.pngimage.dcu in the Delphi library path. You should delete that pngimage.pas and probably pnglang.pas, too.

HI Uwe

 

Thank you so much for your reply. You are right, but seems we need to modifed the source code of PngComponents. The way is replace  pngImage with vcl.Imaging.pngImage. In this way, we can complie the pngComponent successful. But seems the system component, TSpeedButton still can use bmp format, I don't know, why Delphi not suport TSpeedButton use PNG directly, you know, it's already contain VCL.imaging.pngImage internally. Anyway, it works, so thank you so much.

 

Share this post


Link to post

The glyph is an old "obsolate" property to assigning the image, also using png is an old and should not be used in modern applications. Nowdays you should use svg stored in virtual image list to be able to support various DPI settings.

Share this post


Link to post
2 hours ago, cdxfish said:

The way is replace  pngImage with vcl.Imaging.pngImage.

That would break compatibility with older Delphi versions. Either these changes have to be wrapped in some IFDEF directives or one has to specify at least Vcl.Imaging in Unit Scope Names of the project using the library.

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

×