Recent

Author Topic: [solved] Imagelist of popup menu is not updated at runtime  (Read 6191 times)

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
[solved] Imagelist of popup menu is not updated at runtime
« on: September 15, 2012, 11:29:13 am »
I use an imagelist to show icons with popup menu items. When the content of the imagelist is modified at runtime (delete/insert) these changes are not applied to the menu. The imagelist contains the new picture - a simple GetBitmap() and Draw() works well. But how can I update the popup menu?

Tested with Qt for Linux and Darwin (and successfully with Gtk2 and win32/64).

PS: A simple PopupMenu.Images:=nil; ImageList.Delete/Insert; PopupMenu.Images:ImageList; does the trick.
« Last Edit: September 16, 2012, 11:56:16 am by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: Imagelist of popup menu is not updated at runtime
« Reply #1 on: September 15, 2012, 12:42:01 pm »
PS: A simple PopupMenu.Images:=nil; ImageList.Delete/Insert; PopupMenu.Images:ImageList; does the trick.
Yes. I got the same problem with TListView long time ago and this same trick solved problem. But I reported it on bug tracker and it is fixed now. PopMenu probably has same bug with cache.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Imagelist of popup menu is not updated at runtime
« Reply #2 on: September 15, 2012, 12:51:39 pm »
Maybe it's not a LCL bug but a Qt feature  :o
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Imagelist of popup menu is not updated at runtime
« Reply #3 on: September 15, 2012, 09:50:23 pm »
Please open an issue about it and attach example.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Imagelist of popup menu is not updated at runtime
« Reply #4 on: September 15, 2012, 10:48:04 pm »
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Imagelist of popup menu is not updated at runtime
« Reply #5 on: September 16, 2012, 11:15:28 am »
Fixed :)

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Imagelist of popup menu is not updated at runtime
« Reply #6 on: September 16, 2012, 11:56:03 am »
Thanks!  :D
Lazarus 1.7 (SVN) FPC 3.0.0

 

TinyPortal © 2005-2018