Assigning an icon to a code created menu

Hi all,
I managed to assign an icon to a sub-menu without any problem using the “manual” builder.
I’m now creating the same menu through code.
I have my icon ( 32x32) available in the project but I do not manage to find the right syntax to point to the icon :

MySubmenuItem.Icon(???)

image

Where I have the 32x32 picture part of the project so, named “myicon”.
I tried “myicon”, myicon … and can not find a sample somwhere. I guess it is obvious for skilled people but I’m a newbie.
Thanks

In the documentation about menu, read:

Setting icons to menu items

They show 3 icons, not one.

The reference to your Icon (as we cn see in your screen shot) is myIcon. This is what you have to set to the menu to assign the icon.

Please, choose a better name, a name that follows the Menu Name is better (like Icon_File_Open for a File → Open MenuItem).

so you mean ,

MySubmenuItem.Icon(???)

should work ?
using only 1 image works with manual building menu but I can try to create and add the other sizes…

You do not read the documentation if you do not know why 3 icons at different size is needed.
MySubmenuItem.Icon(myIcon)

or
MySubmenuItem.Icon = myIcon

Place the mouse cursor (Pointer) above MySubmenuItem.Icon to get local help (at window’s bottom): usually syntax.

I cannot actually run Xojo (lack of memory / i am doing other (boring) stuff).

1 Like

Thanks Emile, I understand now
the .something is one of the property where (XXX) , is a parameter sent.