Skip to main content
Version: 20 R7 BETA

SET MENU ITEM ICON

SET MENU ITEM ICON ( menu ; menuItem ; iconRef {; process} )

ParameterTypeDescription
menuInteger, TextMenu reference or Menu number
menuItemIntegerNumber of menu item or -1 for the last item added to the menu
iconRefText, IntegerName or number of picture to be associated with menu item
processIntegerProcess number

This command is not thread-safe, it cannot be used in preemptive code.

Description

The SET MENU ITEM ICON command modifies the icon associated with the menu item designated by the menu and menuItem parameters.
You can pass -1 in menuItem in order to specify the last item added to menu.

In menu, you can pass a menu reference (MenuRef) or a menu number. If you pass a menu reference, the command will apply to all the instances of the menu in all the processes. In this case, the process parameter is ignored if it is passed. If you pass a menu number, the command will take the corresponding menu in the main menu bar of the current process into account. If you want to designate another process, pass its number in the optional process parameter.

In iconRef, you can pass the picture to be used as the icon. You can use a a picture file reference or (binary databases only) a library picture.

  • Picture file reference. Two patterns are supported:
    • path: (recommended), for example "path:/RESOURCES/icon.png". For more information, refer to the Filesystem pathnames paragraph.
    • file: (deprecated), for example "file:icon.png". The picture must be located in the Resources folder of the database.
  • Library picture (binary databases only): You can pass either the name or number of the picture. It is generally preferable to use its number rather than its name since picture numbers are unique IDs, which is not the case with names.

Note: Use of a picture file path is recommended since the Picture library is deprecated and is not supported in 4D project databases. In addition, the file: pattern is deprecated, using path: pattern is recommended.

Example

Use of a picture located in the Resources folder of the database:

 SET MENU ITEM ICON($MenuRef;2;"Path:/RESOURCES/english.lproj/spot.png")

See also

GET MENU ITEM ICON