INatAutoContextMenu

#### Search Results

Search

# INatAutoContextMenu

This document covers the following topics:

- Purpose

- Properties

- Methods

## Purpose

Gives access to a specific context menu.

## Properties

The following properties are available:

- Parent

- Studio

- Count

- Caption

### Parent

Used to navigate to the parent interface of this interface.

Natural Data Format | Variant Type | Remark
--- | --- | ---
HANDLE OF OBJECT | VT_DISPATCH (INatAutoContextMenus) | Get only

### Studio

Used to navigate to the root interface.

Natural Data Format | Variant Type | Remark
--- | --- | ---
HANDLE OF OBJECT | VT_DISPATCH (INatAutoStudio) | Get only

### Count

The number of items (commands, separators and pop-up menus) in the menu.

Natural Data Format | Variant Type | Remark
--- | --- | ---
I4 | VT_I4 | Get only

### Caption

A string used to identify the menu, as defined when the menu was created.

Natural Data Format | Variant Type | Remark
--- | --- | ---
A | VT_BSTR | Get only

## Methods

The following methods are available:

- Item

- SubMenu

- InsertCommand

- InsertSeparator

- InsertPopupMenu

- UpdateMenu

### Item

Returns a specific item contained in the menu, based on an index.

#### Parameters

Name | Natural Data Format | Variant Type | Remark
--- | --- | --- | ---
Return value | A | VT_BSTR |
Index | I4 A | VT_I4 VT_BSTR |

> Return value

>   The caption of the menu item (command or pop-up menu) identified by the value specified in Index. If the index identifies a separator, an empty string is returned.

> Index

>   The index of the item in the menu (a value between 1 and Count).

### SubMenu

Returns a specific pop-up menu contained in the menu, based on an index.

#### Parameters

Name | Natural Data Format | Variant Type | Remark
--- | --- | --- | ---
Return value | HANDLE OF OBJECT | VT_DISPATCH (INatAutoPopupMenu) |
Index | I4 A | VT_I4 VT_BSTR |

> Return value

>   The pop-up menu identified by the value specified in Index. If the specified index does not identify a pop-up menu, but a command or a separator, a null interface pointer (NULL-HANDLE) is returned.

> Index

>   As index either a number between 1 and Count or the caption of a pop-up menu can be specified.

### InsertCommand

Inserts a command into the menu.

#### Parameters

Name | Natural Data Format | Variant Type | Remark
--- | --- | --- | ---
Command | HANDLE OF OBJECT | VT_DISPATCH (INatAutoCommand) |
Index | I4 | VT_I4 | Optional

> Command

>   A command to be added to the menu. The command must have been defined before using the method `INatAutoCommands::Add`.

> Index

>   The position in the menu where the command shall be inserted. If Index is omitted, the command is inserted at the last position.

### InsertSeparator

Inserts a separator into the menu.

#### Parameters

Name | Natural Data Format | Variant Type | Remark
--- | --- | --- | ---
Index | I4 | VT_I4 | Optional

> Index

>   The position in the menu where the separator shall be inserted. If Index is omitted, the separator is inserted at the last position.

### InsertPopupMenu

Creates a new pop-up menu and inserts it into the menu.

#### Parameters

Name | Natural Data Format | Variant Type | Remark
--- | --- | --- | ---
Return value | HANDLE OF OBJECT | VT_DISPATCH (INatAutoPopupMenu) |
Caption | A | VT_BSTR |
Index | I4 | VT_I4 | Optional

> Return value

>   The newly created pop-up menu.

> Caption

>   A string used to identify the pop-up menu.

> Index

>   The position in the menu where the pop-up menu shall be inserted. If Index is omitted, the pop-up menu is inserted at the last position.

### UpdateMenu

Changes in a menu are not made visible immediately, in order to avoid flickering. After having finished modifying a menu, make the recent changes visible by calling this method.

### On this page

- Purpose
- Properties
- Methods