[SOLVED} Filling a TMenuItem with colour lazarus / 39-Graphics ---------------------------------------------------------------------- petevick · 2023-11-18 11:39 I want to populate a series of TMenuItems with various coloured backgrounds, no text. I have the TPopupMenu's OwnerDraw property set to True and have the following code in the MenuItems OnDrawItem event...... 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 procedure TForm1.PopPasteDrawItem(Sender: TObject; ACanvas: TCanvas;  ARect: TRect; AState: TOwnerDrawState);begin  ACanvas.Brush.Color := clGreen;  ACanvas.Rectangle(ARect);end; clGreen will eventually be replaced with a variable TColor. It seems that the OnDrawItem isn't being fired, I've placed a debug stop point in the code but it's ignored, and the MenuItem background is not green. I must be doing something fundamentally wrong, but for the life of me I can't see what it is. ---------------------------------------------------------------------- wp · 2023-11-18 12:07 No, not your fault. The code works on Windows, but not on Linux, neither on gtk2 nor on qt5, also not on macOS/cocoa. But even on Windows you will not be very happy because you'd have to repaint everything yourself then: the caption, the gutter, the icons, checkmarks ---------------------------------------------------------------------- petevick · 2023-11-18 12:13 Quote from: wp on November 18, 2023, 01:07:19 pmNo, not your fault. The code works on Windows, but not on Linux, neither on gtk2 nor on qt5, also not on macOS/cocoa. But even on Windows you will not be very happy because you'd have to repaint everything yourself then: the caption, the gutter, the icons, checkmarks Yes, I've just found out about Windows. Unfortunately the code has to run in Linux and Windows. With the MenuItems not having a caption, I was trying to get rid of the 'white space' to the right of the icons column, but obviously TPopupMenu doesn't have a width property, I guess I'm going to have to live with it. Thanks for the reply wp