预订演示

请注意 : 本帮助页面不适用于最新版本的Enterprise Architect. 最新的帮助文档在这里.

前页 后页

EA_MenuClick

EA_MenuClick events are received by an Add-In in response to user selection of a menu option.
The event is raised when the user clicks on a particular menu option. When a user clicks on one of your non-parent menu options, your Add-In receives a MenuClick event, defined as:
     Sub EA_MenuClick(Repository As EA.Repository, ByVal MenuLocation As String, ByVal MenuName As String, ByVal ItemName As String)
This code is an example of use:
     If MenuName = "-&Diagram" And ItemName = "&Properties" then
          MsgBox Repository.GetCurrentDiagram.Name, vbInformation
     Else
          MsgBox "Not Implemented", vbCritical
     End If
Notice that your code can directly access Enterprise Architect data and UI elements using Repository methods.

Syntax

Sub EA_MenuClick (Repository As EA.Repository, MenuLocation As String, MenuName As String, ItemName As String)
The EA_GetMenuClick function syntax has these parameters.

Parameter

Type

See also

Repository

EA.Repository
Direction: IN
Description: An EA.Repository object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information.
Repository Class

MenuLocation

String
Direction: IN
Description: A string representing the part of the user interface that brought up the menu. This can be TreeView, MainMenu or Diagram.

MenuName

String
Direction: IN
Description: The name of the parent menu for which sub-items are to be defined. In the case of the top-level menu this is an empty string.

ItemName

String
Direction: IN
Description: The name of the option actually clicked; for example, 'Create a New Invoice'.

Return Value

None.

Learn more