ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Drop-down menus / WINDEV and WINDEV Mobile
  • Overview
  • Characteristics of a menu option
  • Overview
  • Type of option ("General" tab of the description window)
  • Caption of a menu option
  • Translating the text of menu options
  • Marking/Unmarking a menu option
  • Image associated with a menu option
  • Keyboard shortcut associated with a menu option
  • Displaying the code of a menu option
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV and WINDEV Mobile support two types of drop-down menus:
  • main window menus.
    A main menu is always associated with a window. This menu can be displayed under the window's title bar. For more details, see Managing main window menus.
    AndroidiPhone/iPad In a mobile application, the menu is displayed via the Action Bar control. For more details, see Action Bar of a window.
  • custom context menus.
    The user can open a context menu by pressing the right mouse button.
    For more details, see Custom context menu.
A drop-down menu (main or custom context menu) is composed of one or more options and sub-options. Each option runs a WLanguage code.
For example:
Main menu
Context menu
In the editor, you can handle menu options in the same way for both main menus and custom context menus. To handle the menu options, simply edit the relevant menu.
To edit (or display in the editor):
  • A custom context menu: on the "Window" tab, in the "Bars and menus" group, expand "Popup menus" and select one of the existing context menus.
Remark: WINDEV and WINDEV Mobile also allow you to:
Characteristics of a menu option

Overview

Like controls, menu options have a description window. This description window allows you to configure different aspects of the menu option. To open the description window of an option, select "Option description" in the context menu.

Type of option ("General" tab of the description window)

There are three types of menu options:
  • Standard: Menu option corresponding to a text, with or without a check box or image.
  • Separator: Menu option corresponding to a separator, i.e. a separating line between different options.
  • Break: Menu option consisting of a text and a separator on the same line. Generally, this type of option groups options together under a given name.

Caption of a menu option

"Standard" or "Break" menu options are associated with a text. The text of a menu option can be edited:
  • from the "General" tab of the option description window.
  • directly in the window being edited:
    1. Select a menu option.
    2. Press the Space key.
    3. Edit the text in the input area.
      Modifying the option caption
    4. Press Enter to validate.
    Remark: You can also select "Edit the caption" in the context menu of the menu option.
Tip: To make text bold in the menu option, simply enclose the desired text between <B> and </B> through programming. For example:
OPT_New.Caption = "Rename '''Sheet 1'''"

Translating the text of menu options

You can translate the text of menu options:
  • from the "General" tab of the option description window.
  • in the editor directly:
    1. Display the window in the translation language: on the "Display" tab, in the "Options" group, expand "Language displayed" and select the desired language.
    2. The captions of controls and menu options are displayed in the selected language.
    3. Type the text of options in the selected language (Space key on the menu options).
Reminder: In a multilingual project, the text entered when creating a menu option is applied to all languages supported by the current window

Marking/Unmarking a menu option

"Standard" menu options can be preceded:
  • by a check mark (Checkmark).
  • by a bullet. For example, this checkmark identifies active features.
Menu option with checkmark
To mark a menu item in the editor:
  1. Select the menu option to mark.
  2. Open the "UI" tab in the description window of the menu option ("Option description" in the context menu).
  3. Select the checkmark style to use:
    • Default (Checkmark)
    • Bullet (Radio Button).
  4. Specify whether the option should be checked by default.
  5. Validate.
The selected mark will appear next to the active option when the menu is displayed.
You can use functions multiple properties to handle the mark of an option:
  • WLanguage properties:
    CheckedThe Checked property is used to get and modify the checkmark state of an element.
Remarks:
  • The MenuMark and MenuUnmark functions are equivalent to the Checked property.
    Android Only the Checked property is available.
  • In most cases, a menu option cannot be preceded by both a checkmark and an image.
  • Universal Windows 10 AppiPhone/iPad Options cannot be checked or unchecked.

Image associated with a menu option

An image can be shown next to "Standard" and "Break" menu options.
Menu option with image
To display an image in front of a menu option:
  1. Select the menu option in front of which the image must be displayed.
  2. Open the "UI" tab in the description window of the menu option ("Option description" in the context menu).
  3. Select the image to display. This image can be chosen in the image catalog (click the Drop-down button button and select the "Catalog" option).
  4. Validate.
Remarks:
  • To get or set the image associated with a menu option, use the Image property.
  • In most cases, a menu option cannot be preceded by both a checkmark and an image.
Available image formats:
Android The supported image formats are:
  • Bitmap (*.BMP)
  • Graphics Interchange Format (*.gif)
  • Joint Picture Experts Group (*.jpeg)
  • Portable Network Graphics (*.png)
  • WINDEV images (generated by the image editor, *.WDPIC).
Universal Windows 10 App The supported image formats are:
  • Portable Network Graphics (*.png)
  • Joint Picture Experts Group (*.jpg ; *.jpeg)
  • WINDEV images (generated by the image editor, *.WDPIC).
Universal Windows 10 App

Keyboard shortcut associated with a menu option

Each "Standard" menu option can be associated with a keyboard shortcut.
Reminder: A keyboard shortcut corresponds to an alphanumeric character, a keyboard key or a combination of keyboard keys. This shortcut gives direct access to a menu option from the keyboard.
To associate a keyboard shortcut with a menu option:
  1. Select the menu option to which a keyboard shortcut must be associated.
  2. Open the description window of the current option ("Option description" in the context menu).
  3. In the "General" tab, select the keys that make up the shortcut for the menu option.
    Option shortcut in the editor
  4. Validate the description window. The selected keyboard shortcut appears after the caption of the menu option:
    Shortcuts in the menu options
Remarks:
  • If a context menu option and a control have the same keyboard shortcut, the control will take precedence over the option.
  • Hotkeys are not available in context menus. Only the keyboard shortcuts can be used.
Tip: To avoid displaying the keyboard shortcut after the menu option, simply change the text of the option through programming (Caption properties). For example:
OPT_New.Caption = "New"

Displaying the code of a menu option

To display the code of a menu option:
  1. Select the desired menu option.
  2. Right-click to open the context menu of the option.
  3. Select "Code". The code window of the current menu option is displayed.
Remarks:
  • The code of a menu option can also be displayed from its description window. To do so, click Code icon. This code corresponds to the code run when the menu option is selected by the user. You can add optional events via the "Add other events to xxx" link at the bottom of the code window.
  • Only menu options that do not have a submenu can launch a WLanguage event.
  • "Standard" menu options can also be associated with a preset action. For more details, see Preset_action.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/26/2023

Send a report | Local help