[Solved] Query an image in a TPopupMenu lazarus / 39-Graphics ---------------------------------------------------------------------- petevick · 2023-01-30 17:57 I know that you'd add an image to a TPopupMenu by this code snippet.... 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   imgList:= TImageList(PopupMenu1.Images);  bmp:= TBitmap.Create;  PopupMenu1.Images.BeginUpdate;     try        imgList.GetBitmap(idx, bmp);        bmp.Canvas.Brush.Color := clBlue;        bmp.Canvas.Brush.Style := bsSolid;        bmp.Canvas.Rectangle(0, 0, bmp.Width, bmp.Height);        bmp.TransparentColor := clWhite;      bmp.TransparentMode := tmFixed;        bmp.Transparent := true;      imgList.ReplaceMasked(idx, bmp, clWhite);        finally        bmp.Free;        PopupMenu1.Images.EndUpdate;     end; ....but how would you query what the Canvas.Brush.Color is for any particular image in the TPopupMenu ? I was originally thinking it'd probably be a similar code structure to the above, but now I'm not so sure  It might not even be possible of course ---------------------------------------------------------------------- balazsszekely · 2023-01-30 19:17 Since Idx represents a unique image in the ImageList, save the Brush.Color to a dynamic array. Retrieve with FBrushColor(idx). ---------------------------------------------------------------------- petevick · 2023-01-30 19:51 Quote from: GetMem on January 30, 2023, 08:17:54 pmSince Idx represents a unique image in the ImageList, save the Brush.Color to a dynamic array. Retrieve with FBrushColor(idx). Thanks for the reply GetMem. I get an QuoteError: Identifier not found "FBrushColor"But your suggestion of saving to a dynamic array got me out of the hole I was in. My array is a TColor so to retrieve I just use.... 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 Abutton.Color := Pcol[idx]; ...which works a treat. Thanks yet again for your help GetMem