bitmaplazarustmenuitem

In Lazarus, how to check whether a MenuItem has a Bitmap assigned?


I wrote some Lazarus code that loops through the menu items of the main menu and needs to see whether there's a bitmap assigned to each menu item.

I tried to check with

if Assigned (MenuItem.Bitmap) then...

but this always returns true, whether a bitmap is assigned or not.

Guess the bitmap will be filled with an empty one if there's no actual image assigned.

So how to check whether the image is valid or empty?


Solution

  • ok, found it:

    if not MenuItem.Bitmap.Empty then ...
    

    :)