ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Drop-down menus / WINDEV and WINDEV Mobile
  • Overview
  • Creating a custom context menu
  • Creating a custom context menu
  • Other creation modes
  • Windows 11 context menu
  • Limitations
  • Associating a custom context menu with an element
  • How to?
  • Special case: Context menu of a Table control
  • Remarks
  • Listing the available custom context menus
  • Editing a custom context menu
  • Deleting a custom context menu
  • Handling a custom context menu programmatically
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
Custom context menus are created in the window editor and can be handled programmatically.
You can create and associate these custom context menus with:
  • one or more controls in a window.
  • a window.
Remarks:
  • WINDEV If there is an AAF context menu for this control or for this window, you can:
    • display this AAF menu (or some of the options).
    • display the custom context menu before or after the AAF context menu.
    • display the custom context menu only.
  • iPhone/iPad The context menu adapts to the device used.
    • on iPhone, context menus are displayed at the bottom of the screen:
      Context menu on iPhone
    • on iPad, context menus can be displayed anywhere:
      Context menu on iPad
This help page explains how to:
Creating a custom context menu

Creating a custom context menu

To create a custom context menu:
  1. On the "Window" tab, in the "Bars and menus" group, expand "Popup menus" and select "New context menu". The window for editing the new custom context menu is opened.
    Context menu editor
  2. If necessary, edit the description of the context menu (name, etc.):
    • Open the context menu of the option of the home window (right mouse click in the home window).
    • Select "Context menu description". You can:
      • Modify the name of the custom context menu.
      • WINDEV Indicate if the menu should use:
        • the style defined by the system.
        • the Windows 11 style.
      • Universal Windows 10 AppAndroidiPhone/iPad enter the text of the context menu.
      • Universal Windows 10 AppAndroid Specify whether the context menu should be moved to the action bar.
  3. Add menu options to the new context menu. For more details, see Handling menu options.

Other creation modes

You can also create a custom context menu:
  • from the "UI" tab of the description of a window or window control. Simply click the button to the right of the "Context menu" combo box and select "Create a new context menu". A page for editing the new custom context menu opens. This context menu will be automatically associated with the current element (or with all the elements in case of multi-selection).
    New context menu
  • from the "Manage context menus" window. Simply click the "New" button and enter the name of the new context menu.
    Remark: To open the "Manage context menus" window, go to the "Window" tab, "Bars and menus" group, expand "Popup menus" and select "Edit".

Windows 11 context menu

Windows 11 context menus use a specific style:
  • elements are further apart, which improves visibility,
  • an opening animation is used,
  • a shadow is used to highlight the menu,
  • the most used options appear as icons in the row that is closest to the click point.
To create a context menu using the Windows 11 style:
  1. On the "Window" tab, in the "Bars and menus" group, expand "Popup menus" and select "New context menu". The window for editing the new custom context menu is opened.
  2. Open the context menu description window. Go to the "General" tab, "Menu style" and select "Windows 11".
  3. Validate.
To show a menu option as an icon:
  1. Select the desired option.
  2. Open the option description window.
  3. In the "UI" tab:
    • Specify the image and the number of states.
    • Check "Show this option as a button at the top of the menu (Windows 11 style)".
  4. Validate. The current option is displayed only as an icon.

Limitations

  • AndroidiPhone/iPad Context menus can have only one menu level. Submenus are not available.
  • iPhone/iPad Specific limits:
    • Separators are not available.
    • It is not possible to display checkmarks next to the options.
    • The background color and text color cannot be modified with the Color and BackgroundColor properties.
    • The Grayed property makes the options invisible.
  • Android Specific limits:
    • Separators are not available.
    • The icons displayed before the options are not available.
    • The background color and text color cannot be modified with the Color and BackgroundColor properties.
Associating a custom context menu with an element

How to?

To associate an existing custom context menu with one or more elements (window or controls):
  1. Select the elements you want to associate with the context menu.
  2. Go to the "UI" tab in the description window of the current element(s) ("Description" in the context menu).
  3. The "Context menu" combo box allows you to configure the context menu:
    • the Context menu creation icon button is used to create a new context menu.
    • the combo box is used to:
      • display the AAF context menu and set the options that will be displayed for the current control.
      • display a custom context menu. This context menu can be displayed before or after, or even replace the AAF context menu
  4. Validate.
Remarks:
  • To edit the custom context menu, click the Context menu edit icon button to the right of "Context menu" and select "Edit this context menu".
  • To associate a window or a control with an existing custom context menu through programming, use ContextMenu.
  • WINDEV For more details, see Configuring the menus of AAFs.

Special case: Context menu of a Table control

  • If different context menus are associated with a Table control and with its columns, the context menu associated with the columns will have priority. When a column is right-clicked, only the context menu associated with the column will be displayed.
  • If all the columns of a Table control are associated with one or more context menus, the context menu associated with this control will never be displayed.
  • The AAF context menu associated with a column of a Table control corresponds to the menu with the Table control. The options of this menu cannot be configured.

Remarks

  • A custom context menu can be associated with the controls found in a window (including Table control columns) and with the windows.
  • A custom context menu cannot be associated with the following elements:
    • Static control,
    • non-clickable Image control,
    • Progress Bar control,
    • Shape control,
    • menu option.
  • When performing a Drag and Drop of a window control toward a window, the characteristics of the copied control will be kept. If the copied control is associated with a custom context menu, the menu will be available in both windows.
Listing the available custom context menus
To get all the custom context menus available for a given window, go to the "Window" tab, "Bars and menus" group, expand "Popup menus" and select "Edit". These context menus can be associated with this window or with the controls in this window.
Editing a custom context menu
A context menu can be edited via one of the following methods:
  • on the "Window" tab, in the "Bars and menus" group, expand "Popup menus" and select "<ContextMenuName>".
  • from the "UI" tab in the description of a window or control associated with this context menu:
    • Select the context menu you want to edit from the "Context menu" combo box.
    • Click the Context menu edit icon button to the right of the "Context menu" combo box and select "Edit this context menu".
  • from the "Manage context menus" window:
    • Select the context menu you want to edit.
    • Click the "Edit" button.
Remarks: For more details, see Handling menu options in the editor.
Deleting a custom context menu
To delete a custom context menu:
  1. On the "Window" tab, in the "Bars and menus" group, expand "Popup menus" and select "Edit".
  2. Select the custom context menu to delete.
  3. Click "Delete". The window and/or controls associated with the deleted context menu will no longer be associated with a custom context menu. If available, the default context menu defined by the system (AAF menu) will replace the custom context menu that was deleted.
Handling a custom context menu programmatically
The following functions and properties are used to handle the custom context menus through programming:
ContextMenu propertyGets and sets the custom context menu associated with a control or window. Also used to:
  • associate a control with a context menu.
  • display or hide the default system context menu.
ControlContextMenu functionIdentifies the control on which a custom context menu was opened (to be used in the code of the custom context menu).
OpenContextMenu functionAutomatically opens the context menu of a control or window. You can choose the context menu to open and its position.

Remark: You can also handle the menu options through programming.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/07/2023

Send a report | Local help