PopupMenu-ImageList - Assign different imagelist does not update images in popupmenu
Original Reporter info from Mantis: Hansaplast
-
Reporter name: Hans Luijten
Original Reporter info from Mantis: Hansaplast
- Reporter name: Hans Luijten
Description:
I have an application with a Popupmenu, of which I'd like to change the icons (imagelist) based on the selected theme (Aqua vs Dark).
However, assigning a different imagelist does not update the popupmenu.
It only works the first time one changes the imagelist. Any attempt after that will fail (not update the used images).
What does work:
PopupMenu1.Images:=nil;
PopupMenu1.Images:=ImageList1;
So one must nil the imagelist first, and assign a different imagelist after that (which sounds like a minor issue), otherwise the images in the menu will not be updated.
Steps to reproduce:
Assign a different imagelist to the popupmenu (this works one time only, after that it fails);
PopupMenu1.Images:=ImageList1;
Work around: nil the list first, and then assign the actual list (this always works);
PopupMenu1.Images:=nil;
PopupMenu1.Images:=ImageList1;
I've attached an example project.
Leave "NIL Imagelist first" unchecked.
Right click on the form: imagelist1 is being used (black icons).
Click "Use ImageList2" and right click the form: imagelist2 is now being used (gray icons). This works only once!
Click "Use ImageList1" and right click the form: images did not update and still gray icons are being shown.
Now check "NIL Imagelist first". (now changing the imagelist does work)
Click "Use ImageList1" and right click the form: imagelist1 is being used (black icons).
Click "Use ImageList2" and right click the form: imagelist2 is being used (gray icons).
Additional information:
Lazarus 2.1.0 r61305M FPC 3.0.4 x86_64-darwin-cocoa (alpha)
Mojave 10.14.5
Mantis conversion info:
- Mantis ID: 35658
- OS: macOS
- OS Build: 10.14.x
- Build: 61305
- Platform: Cocoa
- Version: 2.0.3 (SVN)
- Fixed in revision: 61307 (#75accac5)