Domanda

I've got a TToolbar that displays action buttons, and it has some built-in buttons and its own TImageList to supply icons for them.

I've also got a plugin that adds buttons to the toolbar. It has its own TImageList and its own TActionList, and the action list uses icons from the image list. But when I create the buttons and add them to the toolbar, they don't display the images from the image list inside the plugin; they appear to be using the ImageIndex property on the actions, but with the TImageList for the toolbar, so the images are all screwed up.

How can I make it so that the images that get displayed in this case are the images from the TImageList inside the plugin?

È stato utile?

Soluzione

A tool bar has a reference to a single image list. This is a property of the underlying Windows control that is simply reflected on to you by the VCL.

The conclusion is that you must put all the images into the same image list. You cannot have two different image lists referenced by a single tool bar.

One solution would to pass your image list to the plugin and allow it to add glyphs to your image list.

Note that I'm talking about the primary image list. Naturally you use different image lists for disabled images and the hot images. But those don't really contain different glyphs–they contain the same glyphs but rendered in different states.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top