menu_add_submenu() adds groups to a menu. These menu groups will hold menu commands and other menu groups if necessary.
Syntax
menu_add_submenu(menu_id, "label" [, enabled], action_id [, "tooltip"] [, "image"])
Parameters
menu_id |
identifier of the menu to which a new menu group is added (INTEGER) |
label |
|
enabled |
(optional) specifies whether the menu group must be visible or not (INTEGER: 1 or 0) |
action_id |
identifier of the new (=added) menu group (INTEGER) - must be unique for the program |
tooltip |
(optional) specifies the text to be displayed as a tooltip to the menu group (VARCHAR or quoted STRING) |
image |
(optional) specifies the path to the image which will be displayed to the menu group |
Usage and examples
Here is the example of the menu_add_submenu() full syntax:
LET submenu_1 = menu_add_submenu(main_menu_id, "1st menu group", 1, 111, "This is the 1st group in this menu", "qx://application/open2.png")
Here is the example of the menu_add_submenu() basic syntax (no optional parameters are specified):
LET submenu_1 = menu_add_submenu(main_menu_id, "1st menu group", "", 111)
If the third parameter (= enabled) is set to 0, the menu group will be disabled at runtime:
LET submenu_1 = menu_add_submenu(main_menu_id, "1st menu group", 0, 111)
To omit the tooltip at runtime, you have to pass an empty string as the fifth parameter:
LET submenu_1 = menu_add_submenu(main_menu_id, "1st menu group", 1, 111, "", "qx://application/open2.png")
LET submenu_1 = menu_add_submenu(main_menu_id, "1st menu group", 1, 111, "qx://application/open2.png")