PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Associating an image with a menu option
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
MenuAddOption (Function)
In French: MenuAjouteOption
AjaxNot available
Adds a new menu option at the end of a menu. This menu option runs a procedure passed in parameter. To insert a menu option at a specific location, use MenuInsertOption.
Reminder: The name of the main menu is defined:
  • WINDEVWINDEV Mobile in the description window of the window.
  • WEBDEV - Server code in the description window of the menu.
Versions 16 and later
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 16
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Example
// Adds a new menu
MenuAddMenu(MENU_MyMenu, "OPT_Schedule", "Schedule")
// Adds an option into the new menu
MenuAddOption("OPT_Schedule", "OPT_Create", "Create", Create_Schedule)
// Associates an image with the menu option
{"OPT_Create", indControl}..Image = "schedule.png"
// Adds a separator
MenuAddSeparator("OPT_Schedule")
// Adds a new option
MenuAddOption("OPT_Schedule", "OPT_View", "View", View_schedule)
Syntax
<Result> = MenuAddOption(<Name of Initial Menu> , <Name of Option to Create> , <Caption of Option to Create> , <Procedure Name> [, <Procedure Parameter>])
<Result>: Integer
Position of the option in the menu. A fatal error occurs if the option was not added.
<Name of Initial Menu>: Character string (with or without quotes)
Name of the menu into which the menu option must be added. The menu option will be added at the end of this menu.
<Name of Option to Create>: Character string (with quotes)
Name of the menu option to add. This name will be used to handle the menu option by programming. A fatal error occurs if this name corresponds to an existing option.
<Caption of Option to Create>: Character string (with quotes)
Caption of the new menu option. This caption will be displayed in the window and it will allow the user to select the option.
<Procedure Name>: Character string (with or without quotes)
WLanguage procedure called when the menu option is selected.
<Procedure Parameter>: Optional variant
Parameter that can be passed to <Procedure Name> when the menu option is selected by the user.
Remarks

Associating an image with a menu option

To associate an image with a menu option, use ..Image.
Related Examples:
WD LastDocuments Sample components (WINDEV): WD LastDocuments
[ + ] This example explains how the list of last opened documents can be added to the application menu.
This insertion is performed via a class proposed in the "LastDocuments" component.
Four code lines are sufficient to insert the list of last opened documents into an existing application.
These processes can be found in:
- the declaration code of the global variables of the main window,
- the code of the OpenDocument procedure,
- the code of the menu options "File 1" to "File 10".
The example has been simplified regarding the number of features (text files only) in order to highlight the use of the component.
Components
WINDEVReports and Queries wd230obj.dll
WEBDEV - Server code wd230page.dll
Windows Mobile wp230obj.dll
Java wd230java.jar
Linux wd230obj.so
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment