MenuItem.Icon

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Picture )
aMenuItem.Icon = newPictureValue
or
PictureValue = aMenuItem.Icon

Supported for all project types and targets.

A picture that is assigned to the MenuItem.

Notes

On macOS and Linux, the picture appears in its original size. Resize the icon externally before adding it to the project. On Windows, the icon is resized so that its size matches the height of the item's Text. In most cases icons that are 16x16 points look best.

Recent versions of Linux (that use recent version of the GNOME desktop manager), default to not showing menu icons. You can change the OS setting to display menu icons using terminal [1]:

 gsettings set org.gnome.desktop.interface menus-have-icons true

Example

The following code is in the Open event of the main window. The image appears to the left of the menu item's text.

EditFind.Icon = RedApple