I have a TPopupMenu and is filled with 6 items.
2 of these items are color dependent.
I use the following code to change the icons.
TForm_Wedstrijd_Overzicht = class(TForm)
.....
.....
PUM_Wedstrijden: TPopupMenu;
PUM_Wedstrijd_Declaratie: TMenuItem;
PUM_Wedstrijd_Nieuw: TMenuItem;
PUM_Wedstrijd_Bewerken: TMenuItem;
PUM_Wedstrijd_Verwijderen: TMenuItem;
PUM_Wedstrijd_Mail: TMenuItem;
PUM_Wedstrijd_Close: TMenuItem;
private
{ private declarations }
public
{ public declarations }
end;
.....
.....
case KleurPop of
Oranje : begin // Oranje
PUM_Wedstrijd_Mail.ImageIndex := 21;
PUM_Wedstrijd_Declaratie.ImageIndex := 31;
end; // Oranje
Rood : begin // Rood-Rose
PUM_Wedstrijd_Mail.ImageIndex := 22;
PUM_Wedstrijd_Declaratie.ImageIndex := 32;
end; // Rood-Rose
Blauw : begin // Blauw
PUM_Wedstrijd_Mail.ImageIndex := 23;
PUM_Wedstrijd_Declaratie.ImageIndex := 33;
end; // Blauw
Groen : begin // Groen
PUM_Wedstrijd_Mail.ImageIndex := 24;
PUM_Wedstrijd_Declaratie.ImageIndex := 34;
end; // Groen
Paars : begin // Paars
PUM_Wedstrijd_Mail.ImageIndex := 25;
PUM_Wedstrijd_Declaratie.ImageIndex := 35;
end; // Paars
Geel : begin // Geel
PUM_Wedstrijd_Mail.ImageIndex := 26;
PUM_Wedstrijd_Declaratie.ImageIndex := 36;
end; // Geel
else
begin
PUM_Wedstrijd_Mail.ImageIndex := 20; // Black
PUM_Wedstrijd_Declaratie.ImageIndex := 30;
end; // else
end; // case
The first time this code is running it works like a charm. The color is changed.
But when I change the color from 'Rood' to 'Blauw' the code fails to work.
So do i have to refresh the PopupMenu?
If so how?