Obtaining the Category and Caption property information of a custom component


Summary Depending on how a custom component is created in Visual Studio, obtaining the Category and Caption property information looks different in the code base. This topic covers the ways to create custom components, which are implementing Component Object Model (COM) interfaces and ESRI base classes.

In this topic


 

About obtaining the Category and Caption property information of a custom component

Review the following assumptions before proceeding:
  • An ArcGIS Desktop custom component—CustomComponent—was created based upon implementing COM interfaces or ESRI base classes in Visual Studio.
  • The CustomComponent in this topic can show on the Customize dialog box of an ArcGIS Desktop application (that is, ArcMap, ArcGlobe, ArcScene, or ArcCatalog) and can be added to or removed from the ArcGIS Desktop graphical user interface (GUI). Typically these type of CustomComponents are Buttons, Tools, and Toolbars. Examples of CustomComponents that do not show on the Customize dialog box and are not relevant for this topic are Extensions, Dockable Windows, custom table of contents (TOCs), and so on.

    The following screen shot shows an example of an ArcMap Customize dialog box:

Obtaining the Category and Caption property information

Obtain the Category and Caption property information so CustomComponent users know what customization to add to the ArcMap GUI on the Customize dialog box. This section describes how to obtain the relevant information using both coding methods.

Using implemented COM interfaces

The Category and Caption information for CustomComponents generated by implementing COM interface classes is typically found in the Caption and Category methods. See the following code example:
[C#]
public string Caption
{
    get
    {
        return "Caption ArcMapClassLibrary_Implements";
    }
}

public string Category
{
    get
    {
        return "Developer Samples";
    }
}
[VB.NET]
Public ReadOnly Property Caption() As String Implements ESRI.ArcGIS.SystemUI.ICommand.Caption
Get
Return "Caption ArcMapClassLibrary_Implements"
End Get
End Property

Public ReadOnly Property Category() As String Implements ESRI.ArcGIS.SystemUI.ICommand.Category
Get
Return "Developer Samples"
End Get
End Property

Using ESRI base classes

The Category and Caption information for CustomComponents generated by ESRI base classes is typically found in the constructor for the class. In VB .NET, the information is in the MyBase.m_category and MyBase.m_caption properties. In C#, the information is in the base.m_category and base.m_caption properties. See the following code example:
[C#]
public Command1()
{
    base.m_category = "Developer Samples";
    base.m_caption = "Caption ArcMapClassLibrary_BaseCommand";
    base.m_message = "Message - ArcMapClassLibrary_BaseCommand";
    base.m_toolTip = "Tooltip - ArcMapClassLibrary_BaseCommand";
    base.m_name = "Name - ArcMapClassLibrary_BaseCommand";

    //Additional code occurs here ...
}
[VB.NET]
Public Sub New()
    MyBase.New()
    
    MyBase.m_category = "Developer Samples"
    MyBase.m_caption = "Caption ArcMapClassLibrary_BaseCommand"
    MyBase.m_message = "Message - ArcMapClassLibrary_BaseCommand"
    MyBase.m_toolTip = "Tooltip - ArcMapClassLibrary_BaseCommand"
    MyBase.m_name = "Name - ArcMapClassLibrary_BaseCommand"
    
    'Additional code occurs here ...
    
End Sub


See Also:

Deploying custom components
How to deploy a custom component using a setup project
How to ensure that COM component category and COM interop are used in custom components
ESRIRegAsm utility




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime