Skip to main content
Version: 20 R7 BETA

SET MENU ITEM PROPERTY

SET MENU ITEM PROPERTY ( menu ; menuItem ; property ; value {; process} )

ParameterTypeDescription
menuInteger, TextMenu reference or menu number
menuItemIntegerNumber of menu item or -1 for the last item added to the menu
propertyTextProperty type
valueText, Number, BooleanProperty value
processIntegerProcess number

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

Description

The SET MENU ITEM PROPERTY command sets the value of the property for the menu item designated by the menu and menuItem parameters.

You can pass -1 in menuItem 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 the property parameter, pass the property whose value you want to modify and pass the new value in value. For the property parameter, you can use a standard property (one of the constants of the “Menu Item Properties” theme) or a custom property:

  • Standard property: Most of standard properties are available through constants in the “Menu Item Properties” theme.
    | Constant | Type | Value | Comment |
    | -------------------------- | ------ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Access privileges | Text | 4D_access_group | Assign an access group to the command
    0 = All Groups
    >0 = Group ID |
    | Associated standard action | Text | 4D_standard_action | Associate a standard action with a menu item
    See the constants of the Standard Action theme. |
    | n/a | Text | 4D_execute_without_validating | Enable the Execute without validating option (for menu items associated to standard actions).
    True=enable, False (default)=disable |
    | Start a new process | Text | 4D_start_new_process | Activate the "Start New Process" option
    0 = No, 1 = Yes |

In the case of the Associated standard action property, you can pass in the value parameter a standard action name. For a comprehensive list of available actions, please refer to the Standard actions section in the Design Reference manual. Most common actions are also available as constants in the Standard Action theme.

Compatibility Note: In previous releases, constants of the Value for Associated Standard Action theme were used in the value parameter (Longint). Starting with 4D v16 R3, they are deprecated but they are still supported for compatibility.

Note: If the menu item corresponds to the title of a hierarchical sub-menu, the standard action will not be called when the menu item is selected.

  • Custom property: In property, you can pass any custom text and associate a value of the text, number or Boolean type with it. This value will be stored with the item and can be retrieved using the GET MENU ITEM PROPERTY command. You can use any custom string in the property parameter, simply make sure not to use a title used by 4D (by convention, properties set by 4D begin with “4D_”).

See also

Dynamic pop up menu
GET MENU ITEM PROPERTY