Description

Represents a shortcut menu.

For a list of all members of this type, see ContextMenu Members.

Remarks

The ContextMenu class represents shortcut menus that can be displayed when the user clicks the right mouse button over a control. 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 itself. Visible controls 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.

Example

The following example creates a Form and a ContextMenu. When the form is right-clicked, the ContextMenu is displayed. If the user clicks "Exit", the script exits.

Break On $System = CreateObject("Kixtart.System") $Form = $System.Form() $Form.OnRightMouseUp = "RightMouseUp()" $ContextMenu = $System.ContextMenu() $ExitMenu = $ContextMenu.MenuItems.Add("Exit") $ExitMenu.OnClick = "ExitClick()" $Form.Center $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1 Function RightMouseUp() $= $ContextMenu.Show($Form, $Form.MouseX, $Form.MouseY) EndFunction Function ExitClick() Quit() EndFunction




The CHM file was converted to HTML by chm2web software.