TDBAdvGrid and picture files

Hello,<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

I have an application that uses TDBAdvGrid to show the main data of countries (name, population, capital etc). The grid is populated via database table and now I would like to insert the picture of the flag too.

 

The first approach was to insert a blob field and upload each picture of the flag into it. This works but it is too slow and in addition it bloats the database.

 

So, I put all the flags pictures in a folder, insert an extra field in the database with the path of each flag and now I am trying to insert the picture in TDBAdvGrid.

I tried with “CreateFilePicture” but this method seems to have problems when the list of the countries is longer than what the screen can show on the screen at the same time. I also checked into this forum and there was a suggestion to use a HTML template and insert in that template the specifier file://imagefilename as SRC for the image but it not clear to me how to do and it seems this doesn’t work either.

 

Do you have any idea of how to solve my issue ?

 

Many thanks

 

 

Alberto

 

Please have a look at the demo ADODataImage

This shows this particular functionality.

Hello,

This solution would bloat the .exe because I would include the pictures in it and if I try to upload the flags runtime the memory would be filled too.
Isn't there any other way more efficient ?

Many thanks


Alberto

An alternative is to use the OnGetDisplText event and return as string for the cell a value with a HTML image tag that has a reference to a file on the system.

This just did the trick ! I also looked at the example 73 http://www.tmssoftware.com/site/asg73.asp now I have the flag just beside the country name in the same cell.

Many thanks !!!
 
Are yoiu planning to support .png in the HMTL image tags ? (I noticed it can manage GIF,JPG,TIFF so far)

The engine is due to be revised to also make PNG possible but currently, this is because the code also needs to be backwards compatible with old Delphi versions and old Delphi versions didn't have built-in GIF or PNG support.