Skip to content

Incorrect item height in menus having icons in landscape orientation

  • Lazarus/FPC Version: Lazarus 3.99 (rev main_3_99-904-gcd92f94f) FPC 3.2.2 i386-win32-win32/win64
  • Operating System: Windows-11, Linux Mint gtk2)
  • CPU / Bitness: 64, IDE is 32-bit

What happens

A popupmenu can display icons at the left of each menu item. Normally the icons are square. However, when the imagelist has Width > Height, i.e. contains icons in "landscape" orientation, the height of the menu items is calculated as if the icons were squere, and the items become too high.

See also discussion in German forum https://www.lazarusforum.de/viewtopic.php?f=55&t=15206.

What did you expect

The height of the menu items should be given by the icon height no matter what the image aspect ratio is (or the text height if that is larger).

Steps to reproduce

popupmenu_nonsquare_icons.zip

The attached project uses an imagelist with icons of 120x80 pixels; it is attached to a popumenu assigned to a button. When the button is right-clicked, the items of the popupmenu are seen to be too high. Screenshot popumenu_laz.png is taken on Windows, the same observation, however, can be made on Linux/gtk2. On qt5, the icon is scaled down to text height which is not correct either.

popupmenu_laz

In Delphi on the other hand, the item height is as expected - see screenshot popupmenu_Delphi.png

popupmenu_delphi