ContextMenu
Represents a context menu associated to a Control.
Last updated
Represents a context menu associated to a Control.
Last updated
The ContextMenu class represents shortcut menus that can be displayed when the user clicks the right mouse button over a control or area of the form. Shortcut menus are typically used to combine different menu items from a MainMenu of a form that are useful for the user given the context of the application. For example, you can use a shortcut menu assigned to a TextBox control to provide menu items for changing the font of the text, finding text within the control, or Clipboard features for copying and pasting text. You can also display new MenuItem objects in a shortcut menu that are not located within a MainMenu to provide situation specific commands that are not appropriate for the MainMenu to display.
Typically, a shortcut menu is displayed when a user clicks the right mouse button over a control or the form itself. Visible controls and Form have a ContextMenu property that binds the ContextMenu class to the control that displays the shortcut menu. More than one control can use a ContextMenu. You can use the SourceControl property to determine which control last displayed the shortcut menu in order to perform tasks specific to the control or to modify the shortcut menu displayed for the control.
You might want to know when the shortcut menu is being displayed in order to set check marks, disable items, and perform other menu tasks before the menu is displayed to the user. You can handle the Popup event to determine when the shortcut menu is being displayed.
For a full list of properties, methods and events see the API documentation.
The ContextMenu can be reused and assigned to any control that supports the ContextMenu property.
The same ContextMenu instance is assigned to both the Button and ComboBox controls.
Item | Description |
---|---|
Class name | "wisej.web.menu.ContextMenu" |
Theme appearance | "item", see Themes. |
Child components | "icon" is the item's icon, if applicable. "shortcut" is the item's shortcut. "arrow" is the **> **arrow icon. |
Source code |