CreateContextMenu Event

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)

Syntax

ControlName_CreateContextMenu ( menuHandle, x, y)

Applies To

SequenceView

Purpose

Occurs when the user right-clicks on the control so the application can build a context menu from which the user can select commands. Although you can implement context menus in most environments without using this event, some environments do not provide any other way to create a context menu. Also, creating a context menu using this event requires less code in most environments, especially when the context menu contains only TestStand commands.

Parameters

menuHandle As Long

[In] Specifies the Microsoft Windows menu handle (HMENU). When you add menu items to the menu handle, the control displays them in a context menu. Use the Commands.InsertIntoWin32Menu method to insert TestStand commands to the menu.

You can also use the menu functions in the Windows Software Development Kit (SDK) to add other menu items. Menu items you add this way do not have an associated TestStand command. When the user selects an item that does not have a TestStand command, the control creates and executes a Command object of kind CommandKind_Custom. The control stores the menu item identifier (resource ID/command ID) as a long in the Command.UserData property and as a decimal string in the command display name. You can handle either the ApplicationMgr.PreCommandExecute or ApplicationMgr.PostCommandExecute event to receive a notification when the user selects a menu item you insert with the Windows SDK.

When the context menu closes, the control disposes of the menu items. Thus, you do not need to dispose of menu items you insert.

x As long

[In] Specifies the horizontal position of the right-mouse click, relative to the control.

y As long

[In] Specifies the vertical position of the right-mouse click, relative to the control.


See Also

ApplicationMgr.PostCommandExecute

ApplicationMgr.PreCommandExecute

Command.UserData

Commands.InsertIntoWin32Menu

WAS THIS ARTICLE HELPFUL?

Not Helpful