INatAutoCommands

This document covers the following topics:


Purpose

The collection of commands defined by plug-ins.

Properties

The following properties are available:

Parent

Used to navigate to the parent interface of this interface.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoControlBars) Get only

Studio

Used to navigate to the root interface.

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

System

The number of commands that were registered by plug-ins.

Natural Data Format Variant Type Remark
I4 VT_DISPATCH (INatAutoSystem) Get only

Methods

The following methods are available:

Add

Creates a new command and adds it to the collection.

Parameters

Name Natural Data Format Variant Type Remark
Return value HANDLE OF OBJECT VT_DISPATCH (INatAutoCommand)  
CommandID I4 VT_I4  
Caption A VT_BSTR  
Image

A
HANDLE OF OBJECT
I4

VT_BSTR
VT_DISPATCH (IPictureDisp)
VT_I4

Optional
Return value

The newly added command.

CommandID

Numeric ID of the new command. The plug-in can choose any positive integer value. When the user later selects the command in the user interface, this ID is passed to the plug-in in the method INaturalStudioPlugIn::OnCommand.

Caption

A string used to identify the command in menus and toolbars.

Image

An image used to represent the command visually. The image must be a 16 color, 16x16 bitmap, using RGB(192,192,192) as the background color.

The image can be specified in three ways:

  • As an absolute path name of a .bmp file.

  • As an IPictureDisp interface. An IPictureDisp interface can be created in Natural using the method INatAutoImages::LoadImage. An IPictureDisp interface cannot be passed across process boundaries. This is due to a Microsoft restriction (MSDN Q150034). Therefore this alternative can only be used with plug-ins running as in-process servers. Natural written plug-ins always run as local servers and can therefore not use this alternative.

  • As an index into a table of user images pre-defined in Natural Studio. These are the images that can be assigned to user commands in the Customize dialog.

Item

Returns a specific command from the collection. Used to iterate through the collection.

Parameters

Name Natural Data Format Variant Type Remark
Return value HANDLE OF OBJECT VT_DISPATCH (INatAutoCommand)  
Index I4 VT_I4  
Return value

The command identified by the value specified in Index.

Index

The index of the command in the collection (a value between 1 and Count).