Jump to content
Ian Branch

ImageLists. One or Multiple??

Recommended Posts

Hi Team,

This may be as much a philosophical as a practical question....

Given a multi form (30+) App with a Datamodule.

Is it better to have one ImageList in the Datamodule with all the images/icons in it, or, a separate imagelist in each form with just the form's images/icons in it? 

Many images/icons, i.e. 'Close' are shared in many forms.

Given that the forms are created/destroyed at during the App's run time.

I'm inclined to go for individual form imagelists.

What are your thoughts?  Is there a 'best practice' for this?

 

Regards,

Ian

Share this post


Link to post

I passed TImagaCollecton + TVirtaulImageList. I recommend it.
Now to the topic. I'm behind only one central image container. And refer to him. Reasons:

  • The application does not inflate unnecessarily
  • Especially if I need a change, I'll make it in one place. It is automatically reflected in all places of use

Share this post


Link to post

Hi...:classic_cool:

Quote

Especially if I need a change, I'll make it in one place.

...+1:classic_cheerleader:

Share this post


Link to post

As an aside what annoys me about image lists in Delphi is that they lump all images in one big dfm blob. I like to keep my icons in icon files and link them as a resource. Then load them up at runtime. It means that when you need to update one you just change the ico file in one place. But then you don't get to see icons at design time. I'd like to have my icons in resources and see them at design time. Such a system must be possible. 

  • Like 3

Share this post


Link to post
2 hours ago, David Heffernan said:

As an aside what annoys me about image lists in Delphi is that they lump all images in one big dfm blob. I like to keep my icons in icon files and link them as a resource. Then load them up at runtime. It means that when you need to update one you just change the ico file in one place. But then you don't get to see icons at design time. I'd like to have my icons in resources and see them at design time. Such a system must be possible. 

DevEx cxImageLists at least store the individual images in separate blob subitems. And they don't change the blobs on every occasion.

Share this post


Link to post

When High DPI support comes into play, there is near to none alternative to a central TImageCollection and individual TVirtualImageLists on each form. Using some SVG ImageCollection reduces the amount of different image sizes needed as well as the DFM size storing them.

 

For years I practiced the several TImageLists in one datamodule approach, but that changed very quickly with High DPI support in my applications.

Share this post


Link to post
4 hours ago, David Heffernan said:

I'd like to have my icons in resources and see them at design time. Such a system must be possible.

It almost was, but they dropped that ball long time ago: http://melander.dk/reseditor/

The resource editor was meant to be a part of Delphi 2010 but even though I implemented all Embarcadero's requirements (primarily two-way RC file support) the required open tools API was never surfaced in Delphi (basically just the ability to register a custom module editor). And when they stopped communicating I simply gave up on that project. I almost deleted the source in anger.

  • Sad 2

Share this post


Link to post

Hi Team,

So It appears I am missing some practical knowledge in regard to the usage of TImageCollection & TVirtualImageLists.  😞

I had a read of the Documentation and am still somewhat confused.

I don't/can't see how having a TImageCollection in a datamodule, and TVirtualimagelists on the visible forms referring back to the TImageCollection, is better than having a just a TImageList on the datamodule and referring to it in the forms.

Could someone enlighten me please?

 

Regards & TIA,

Ian

 

Share this post


Link to post
 

Becose:

  • TVirtualimagelist renders images according to HDPI. It is a duty - see help
  • This technology gives visibly better results
  • If you look in dfm, you will find TVirtualimagelist only stores links to images
  • You only add the necessary images to TVirtualimagelist

I tried this: TAdvGlowButton has three types of images "Normal", Disable and Hot. I set the size 16/18, 24/26 and 32/36 for Hot. This achieved the "pop-up" effect of the button when aiming. Rendered it's perfect. With old technology, this is impossible in my opinion.

Share this post


Link to post

Hi Stano,

Tks.  Now I see the picture.

I have implemented it without issue.

 

Regards,

Ian

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

×