|
|
|
|
- Overview
- Principle
- WLanguage functions
- WLanguage properties
Handling menu options programmatically
The menu options can be handled:
Options are handled in the same way in context menus and main menus. To handle a menu option programmatically, use the following syntax: - "<Option name>" if the menu option is handled from the window.
- "<Window name>.<Menu name>.<Option name>" if the option is handled from another window.
Remark: You can also handle context menus programmatically, not only their options. For more details, see Custom context menu. WLanguage functions WINDEV and WINDEV Mobile include several WLanguage functions specific to menu options:
| | EnumMenu | Returns:- the name of nth option or sub-option found in the main menu of window.
- the name of nth option or sub-option found in a custom context menu (created with WINDEV or WINDEV Mobile).
| MenuAdd | Adds an existing popup menu into the main menu of the current window. | MenuAddMenu | Adds a new menu to an existing drop-down or context menu of a window or page. | MenuAddOption | Adds a new option after the last option of a drop-down or context menu. | MenuAddSeparator | Adds a new separator in a menu (drop-down or context menu). | MenuClone | Clones a menu or a menu option as well as the associated code. | MenuDelete | Deletes a menu or a menu option. | MenuExist | Indicates whether a menu option exists in a menu. | MenuInsertMenu | Inserts a menu before another menu in a window. | MenuInsertOption | Inserts a new option at a specific position. | MenuInsertSeparator | Inserts a separator into a menu. | MenuInvisible | Makes a menu option invisible (popup menu or drop-down menu). | MenuIsMarked | Used to find out whether a checkmark is displayed in front of a menu option (popup menu or drop-down menu). | MenuLabel | Gets or changes the label of a menu option (context or drop-down menu). | MenuMark | Positions the checkmark in front of the menu option (popup menu or drop-down menu). | MenuSelectMinus | Disables (grays out) a menu option (popup menu or drop-down menu). | MenuSelectPlus | Enables a menu option (popup menu or drop-down menu). | MenuState | Identifies the state of a menu option (context menu or drop-down menu): active, inactive or invisible. | MenuUnMark | Removes the checkmark displayed in front of the menu option (popup menu or drop-down menu). |
WLanguage properties WINDEV and WINDEV Mobile include several WLanguage properties specific to menu options: | | Caption | Gets and sets the text of a menu option | Checked | Allows you to use a checkmark ( ) next to a menu option. | Group | Determines if the menu option is part of a group of controls | Image | Gets and sets the image of a menu option | Message | Gets and sets the help message of a menu option | Name | Gets the name of a menu option | Occurrence | Gets the number of options in a menu. | Report | Gets and sets the state of a menu option (active, inactive or grayed) | Type | Determines if the element used is a menu option | Value | Gets and sets the number associated with a menu option | Visible | Determines if a menu option is visible and shows or hides the option |
Related Examples:
|
Unit examples (WINDEV): Managing the main menu of a window by programming
[ + ] Handling the options found in the main menu of a window. This example is used to: - Select or deselect a menu option - Make a menu option visible or invisible - Modifying the caption of a menu option - Mark or unmark a menu option - Run the code of a menu option
|
|
Training (WINDEV): WD Animated Menu
[ + ] The "WD Animated Menu" example proposes several menu animations, based on the interface of the full example named "WD Managing Orders". These animations allow the main menu to be more attractive and dynamic when opening the window: - appearance of the menu buttons with a fade-in effect, - movement of the buttons - etc.
|
|
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.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|