2
votes

I have a Delphi VCL form application (for Windows) with a TabControl component, where tabs are created at run time. Images property is linked to a ImageList, and I am using the OnGetImageIndex event to set the image index for each tab, based on a status information. At certain point, when status change, I need to update this images (indexes). My first idea is to call:

TabControl1.Invalidate;

But it doesn't work. I also tried another approachs without success:

TabControl1.Repaint;

RedrawWindow(TabControl1.Handle, nil, 0, RDW_ERASE or
  RDW_INVALIDATE or RDW_ALLCHILDREN);

Please, how can I force OnGetImageIndex for each tab? Thanks!

1

1 Answers

5
votes

You can call the protected UpdateTabImages method which sends a TCM_SETITEM for each tab.

type
  TAccessTabControl = class(TTabControl);

...

  TAccessTabControl(TabControl1).UpdateTabImages;