Recent

Author Topic: PopupMenu on dock menu  (Read 316 times)

systemgvp

  • New Member
  • *
  • Posts: 46
PopupMenu on dock menu
« on: May 17, 2026, 03:35:31 am »
I created this little dock menu, now I would like that clicking on a Timage opens a menu like TPopupMenu, but with a default position (above the dock, not towards the bottom) and that each item contains a non-small icon.

systemgvp

  • New Member
  • *
  • Posts: 46
Re: PopupMenu on dock menu
« Reply #1 on: May 17, 2026, 02:43:26 pm »
If I use GTK2 the size appears correct, but if I use QT it is stuck at 16, it does not change.

zeljko

  • Hero Member
  • *****
  • Posts: 1958
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: PopupMenu on dock menu
« Reply #2 on: May 17, 2026, 03:14:22 pm »
Without single line of code (example project) nobody can help you.

systemgvp

  • New Member
  • *
  • Posts: 46
Re: PopupMenu on dock menu
« Reply #3 on: May 17, 2026, 03:19:02 pm »
the code is in the image

zeljko

  • Hero Member
  • *****
  • Posts: 1958
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: PopupMenu on dock menu
« Reply #4 on: May 17, 2026, 04:07:29 pm »
You want me to re-type your code :) ? Really funny. Also what is your system ? x11 or wayland ? What is your lazarus version ?

wp

  • Hero Member
  • *****
  • Posts: 13571
Re: PopupMenu on dock menu
« Reply #5 on: May 17, 2026, 04:13:34 pm »
You are calling PopupMenu.Popup, but there is also a PopupMenu.Popup(X, Y) where you can control the position at which the menu is supposed to appear. Note that X,Y are screen coordinates.

If you want to have icons next to the menu items, you must add a TImageList to which you add all icons, assign the imagelist to the Images property of the PopupMenu, and each MenuItem gets the index of its icon into the image list in the ImageIndex property.

systemgvp

  • New Member
  • *
  • Posts: 46
Re: PopupMenu on dock menu
« Reply #6 on: May 17, 2026, 06:59:01 pm »
thanks, I use lazarus 4.6 on kubuntu with QT6.
I use TImageList, but with GTK2 the images are 48x48 (ok) but with QT6 dont change from 16x16

wp

  • Hero Member
  • *****
  • Posts: 13571
Re: PopupMenu on dock menu
« Reply #7 on: May 17, 2026, 07:45:32 pm »
Set the Width and Height of the ImageList, before adding images, to 48 and add use 48x48 images. Note that such icons are rarely found... The Lazarus general purpose icon collection (folder "images/general_purpose") does have them, though.

systemgvp

  • New Member
  • *
  • Posts: 46
Re: PopupMenu on dock menu
« Reply #8 on: May 17, 2026, 08:32:50 pm »
I did exactly this, but it only works if I use GTK, while on QT6 I can set whatever size I want, but it always shows me 16x16.

 

TinyPortal © 2005-2018