Menu Object

The Menu object is used to control the user-defined menu of the ConceptDraw application.

Properties

CmdID Read-only. The menu ID.
Caption The name of the menu.
Prompt The prompt for the menu.
Enabled A flag that specifies whether the menu is enabled or disabled.
Parent Read-only. The parent menu for the menu.

Methods

AddMenuItem Adds a menu item.
MenuItem Returns a menu item by its index in the menu collection.
MenuItemByCmdID Returns a menu item by its ID (the CmdID property).
MenuItemsNum Returns the number of items in the menu.
RemoveMenuItem Removes a menu item by its index in the menu collection.
RemoveMenuItemByCmdID

Removes a menu item by its ID (the CmdID property).

RemoveAll Removes all menu items.
FindMenuItem Searches for a menu item among the items of the menu.

Remarks

An instance of the Menu object can be retrieved by using the following methods and properties:
Application object: CustomMenu property,
Document object: CustomMenu property,
Menu object: Parent property,
MenuItem property: Parent property, SubMenu property.

 

Example

An aplication level or a document level script can add items to the custom menu of the document and process them by using its own procedures. Below is an example of such program:

' Definition of procedure
Sub MenuItem1_CmdProc(cmdArgs As String)

       Trace "MenuItem1 : " & cmdArgs

        ' ...
        ' ...

End Sub

Dim mi As MenuItem

' Enable Document custom menu
thisDoc.CustomMenu.Caption = "My Doc menu"

' Add menu item
set mi = thisDoc.CustomMenu.AddMenuItem(0)
' Set menu item caption
mi.Caption = "Item 1"
mi.OnCmdArgs = "Args string from menu item"
        
' Set processing procedure
mi.SetCmdProcessing("MenuItem1_CmdProc") 

' Suspends execution
Stop

 

See Also

Application object, Document object, MenuItem object