Forum > TAChart

TTabControl images

(1/2) > >>

mtanner:
This is probbaly an idiot's question.

I have a TTabControl with an imagelist assigned to the Images property of the TTabControl. But the images do not appear on the tabs. Apart from assigning the imagelist, what else do I have to do to make the images appear?i

wp:
Use the OnGetImageIndex event.

mtanner:
Could you please elaborate a bit more? What I expected was for the imagelist for a TTabControl to operate like an imagelist for a popupmenu or a toolbar, where assigning the imagelist and image indices for the components is enough, with no need for user-coding in events.

wp:
Hey come on, what is the problem to double-click at the OnGetImageIndex event of the TTabControl and look at the auto-generated code? You will see immediately how you can assign an image index to a tabsheet. It is a bit different from what you know from a menu item or toolbutton because all tabs of the TTabControl are the same, they only differ by their caption which is defined in a stringlist..

mtanner:
Well of course I can easily create an OnGetImageIndex event. I tried using the event to assign an ImageIndex, no difference. The event handler is actually receiving the correct ImageIndex any way. (The ImageIndex value I'd want to use will allways be the TabIndex value, which is the default. )

To be clear, I'm talking about a TTabControl, not a TPageControl. With TPageControl, if I assign an imagelist to the TPageControl.Images, then set the ImageIndex property of a contained TTabsheet, then the image referenced appears on the tab, just as I'd expect.

Navigation

[0] Message Index

[#] Next page

Go to full version