[SOLVED] TPopUpMenu and changing icons lazarus / 21-General ---------------------------------------------------------------------- madref · 2023-01-15 18:55 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. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   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? ---------------------------------------------------------------------- howardpc · 2023-01-15 19:37 Assigning different imageindex values to popupmenu items on Windows changes the menuitem display consistently correctly. So perhaps this is a Mac bug if your code logic is correct (you do not show compilable code). ---------------------------------------------------------------------- madref · 2023-01-16 07:51 I know th code is correct. Because I use the same code on a different popupmenu which is in the main form. So that is why it is so curious... Will try and make a runnable program to compile ---------------------------------------------------------------------- madref · 2023-01-16 11:39 Made a working version of my app. You can download it at [LINK DELETED] It is 60Mb due to some pictures I had to let in for demonstration of changing the colors. In the Files-Menu you can change the colors under [Options]. In the Games-Menu you can open the [Overview of Games] and there is the popupmenu under your right-mouse button. Play with the colors multiple times and this popupmenu will not change (at least in MacOS). Hope you can help me with my problem ---------------------------------------------------------------------- madref · 2023-01-23 17:32 just to bump up and see if someone knows an answer ---------------------------------------------------------------------- wp · 2023-01-23 18:19 Sorry, please simplify the project in reply #3. I am not willing to install "tons" of third-party components. Remove everything which is not needed to show the issue. ---------------------------------------------------------------------- madref · 2023-01-23 20:08 As requested. I have simplified the app. The link stayed the same [LINK DELETED] But now it is just over 10Mb ---------------------------------------------------------------------- wp · 2023-01-23 20:56 I still cannot load the project, it requires BGRAControls. Sorry to be insistent... ---------------------------------------------------------------------- madref · 2023-01-23 22:40 yes it is needed everywhere ---------------------------------------------------------------------- jamie · 2023-01-23 22:52 Quote from: madref on January 23, 2023, 11:40:04 pmyes it is needed everywhere https://youtu.be/2Q_ZzBGPdqE ---------------------------------------------------------------------- howardpc · 2023-01-24 09:26 Even with BGRA installed, and the synapse library referenced correctly I cannot compile your project because of a missing file Referee5_DB.xml. ---------------------------------------------------------------------- madref · 2023-01-24 10:00 That is in the bundle. And it looks like this: Code: [Select]